Fix an analyser warning in the latest llvm
Error is: ASIHTTPRequest.m:4571:44: Division by zero I think this may be a false warning, or llvm is assuming that "[bandwidthUsageTracker addObject:...];" has failed for some reason, but it does no harm to double check that we're not going to divide by zero.
Showing
1 changed file
with
2 additions
and
1 deletions
| @@ -4568,7 +4568,8 @@ static NSOperationQueue *sharedQueue = nil; | @@ -4568,7 +4568,8 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 4568 | for (NSNumber *bytes in bandwidthUsageTracker) { | 4568 | for (NSNumber *bytes in bandwidthUsageTracker) { |
| 4569 | totalBytes += [bytes unsignedLongValue]; | 4569 | totalBytes += [bytes unsignedLongValue]; |
| 4570 | } | 4570 | } |
| 4571 | - averageBandwidthUsedPerSecond = totalBytes/measurements; | 4571 | + if (measurements > 0) |
| 4572 | + averageBandwidthUsedPerSecond = totalBytes/measurements; | ||
| 4572 | } | 4573 | } |
| 4573 | 4574 | ||
| 4574 | + (unsigned long)averageBandwidthUsedPerSecond | 4575 | + (unsigned long)averageBandwidthUsedPerSecond |
-
Please register or login to post a comment