Authored by Olivier Poitrey

Merge pull request #929 from kirualex/patch-2

Handle empty urls NSArray
@@ -120,10 +120,16 @@ @@ -120,10 +120,16 @@
120 self.completionBlock = completionBlock; 120 self.completionBlock = completionBlock;
121 self.progressBlock = progressBlock; 121 self.progressBlock = progressBlock;
122 122
123 - // Starts prefetching from the very first image on the list with the max allowed concurrency  
124 - NSUInteger listCount = self.prefetchURLs.count;  
125 - for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) {  
126 - [self startPrefetchingAtIndex:i]; 123 + if(urls.count == 0){
  124 + if(completionBlock){
  125 + completionBlock(0,0);
  126 + }
  127 + }else{
  128 + // Starts prefetching from the very first image on the list with the max allowed concurrency
  129 + NSUInteger listCount = self.prefetchURLs.count;
  130 + for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) {
  131 + [self startPrefetchingAtIndex:i];
  132 + }
127 } 133 }
128 } 134 }
129 135