MRProgress icon indicating copy to clipboard operation
MRProgress copied to clipboard

Crash when progress value changes is too small

Open alexchan1680 opened this issue 8 years ago • 0 comments

@implementation MRCircularProgressView {
    int _valueLabelProgressPercentDifference;
}

As you declared that variable as int, it is crashing here.

// Add timer to update valueLabel
    _valueLabelProgressPercentDifference = (progress - self.progress) * 100;
    CFTimeInterval timerInterval =  self.animationDuration / ABS(_valueLabelProgressPercentDifference);
    self.valueLabelUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:timerInterval
                                                                  target:self
                                                                selector:@selector(onValueLabelUpdateTimer:)
                                                                userInfo:nil
                                                                 repeats:YES];

if progress - self.progress value is smaller than 0.001 then 100% crash because difference becomes zero. I found it when reporting progress from CloudKit asset download and I did nothing tricky to make it crash.

I am not sure if this is bug or not :), but wanted to let you know.

Thanks.

alexchan1680 avatar Apr 08 '16 09:04 alexchan1680