MRProgress
MRProgress copied to clipboard
Fix crash when a small change in progress
Crash reason in - animateToProgress:
_valueLabelProgressPercentDifference = (progress - self.progress) * 100; // (int) 0 CFTimeInterval timerInterval = self.animationDuration / ABS(_valueLabelProgressPercentDifference); // NaN
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);
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.
Also getting this crash
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.