Authored by Olivier Poitrey

Merge pull request #647 from musaicapp/bug

Prefetcher: check progressBlock is not nil before executing.
@@ -57,13 +57,17 @@ @@ -57,13 +57,17 @@
57 self.finishedCount++; 57 self.finishedCount++;
58 58
59 if (image) { 59 if (image) {
60 - self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 60 + if (self.progressBlock) {
  61 + self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
  62 + }
61 #ifdef SD_VERBOSE 63 #ifdef SD_VERBOSE
62 NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count); 64 NSLog(@"Prefetched %d out of %d", self.finishedCount, self.prefetchURLs.count);
63 #endif 65 #endif
64 } 66 }
65 else { 67 else {
66 - self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 68 + if (self.progressBlock) {
  69 + self.progressBlock(self.finishedCount,[self.prefetchURLs count]);
  70 + }
67 #ifdef SD_VERBOSE 71 #ifdef SD_VERBOSE
68 NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]); 72 NSLog(@"Prefetched %d out of %d (Failed)", self.finishedCount, [self.prefetchURLs count]);
69 #endif 73 #endif