Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when a small change in progress #108

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AddAloner
Copy link

Crash reason in - animateToProgress:

_valueLabelProgressPercentDifference = (progress - self.progress) * 100; // (int) 0
CFTimeInterval timerInterval = self.animationDuration / ABS(_valueLabelProgressPercentDifference); // NaN

@mrackwitz
Copy link
Owner

Thanks for pointing out the crash. But I'm pretty sure rather the whole calculation further below should be changed, as that seems to be really wrong.

-_valueLabelProgressPercentDifference = (progress - self.progress) * 100;
-CFTimeInterval timerInterval =  self.animationDuration / ABS(_valueLabelProgressPercentDifference);
+CFTimeInterval timerInterval = self.animationDuration * ABS(progress - self.progress);

@jaybowang
Copy link

I got this crash too. NaN crash.

@mrackwitz Could you please fix it and release a new version?
It's been a while since this issue was created in Sep. 2015. I know there must be somebody else using this awesome progress view and hope this crash can be fixed.

@brnunes
Copy link

brnunes commented Sep 1, 2016

Also getting this crash

@Airtower
Copy link

Airtower commented Sep 1, 2016

I did too. I found the error in the code and I added a simple isNan() check. If it is NAN, I set the progress to zero. A proper fix would be nice though.

jaybowang added a commit to jaybowang/MRProgress that referenced this pull request Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants