Skip to content

Commit 22a281e

Browse files
committed
fix crash when timerInterval is NaN in animateToProgress: method.
mrackwitz#108
1 parent 661a46a commit 22a281e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Components/MRCircularProgressView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ - (void)animateToProgress:(float)progress {
231231
// Add timer to update valueLabel
232232
_valueLabelProgressPercentDifference = (progress - self.progress) * 100;
233233
CFTimeInterval timerInterval = self.animationDuration / ABS(_valueLabelProgressPercentDifference);
234+
235+
if (isnan(timerInterval)) {
236+
timerInterval = self.animationDuration;
237+
}
238+
234239
self.valueLabelUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:timerInterval
235240
target:self
236241
selector:@selector(onValueLabelUpdateTimer:)

0 commit comments

Comments
 (0)