Use MAX to constrain _activityCount to non-negative numbers
This commit is contained in:
parent
e35a88fdef
commit
68adeab768
1 changed files with 1 additions and 4 deletions
|
|
@ -118,12 +118,9 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17;
|
|||
}
|
||||
|
||||
- (void)decrementActivityCount {
|
||||
if (_activityCount == 0) {
|
||||
return;
|
||||
}
|
||||
[self willChangeValueForKey:@"activityCount"];
|
||||
@synchronized(self) {
|
||||
_activityCount--;
|
||||
_activityCount = MAX(_activityCount - 1, 0);
|
||||
}
|
||||
[self didChangeValueForKey:@"activityCount"];
|
||||
[self updateNetworkActivityIndicatorVisibilityDelayed];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue