Skip to content

Fix crash when a small change in progress#108

Open
AddAloner wants to merge 5 commits into
mrackwitz:masterfrom
AddAloner:master
Open

Fix crash when a small change in progress#108
AddAloner wants to merge 5 commits into
mrackwitz:masterfrom
AddAloner:master

Conversation

@AddAloner

Copy link
Copy Markdown

Crash reason in - animateToProgress:

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

@mrackwitz

Copy link
Copy Markdown
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
Copy Markdown

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

brnunes commented Sep 1, 2016

Copy link
Copy Markdown

Also getting this crash

@Airtower

Airtower commented Sep 1, 2016

Copy link
Copy Markdown

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