Check progressBlock is not nil before executing.

This commit is contained in:
Michael Henderson 2014-03-04 14:10:50 +10:00
parent 5f3e9272c8
commit f2546c7333
1 changed files with 6 additions and 2 deletions

View File

@ -57,13 +57,17 @@
self.finishedCount++;
if (image) {
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
if (self.progressBlock) {
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
}
#ifdef SD_VERBOSE
NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count);
#endif
}
else {
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
if (self.progressBlock) {
self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
}
#ifdef SD_VERBOSE
NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]);
#endif