Replacing #1018 - avoid warning "<Error>: ImageIO: CGImageSourceCreateWithData d…
…ata parameter is nil" if imageData is nil
Showing
1 changed file
with
3 additions
and
2 deletions
@@ -372,8 +372,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis | @@ -372,8 +372,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis | ||
372 | if (completionBlock) { | 372 | if (completionBlock) { |
373 | if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) { | 373 | if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) { |
374 | completionBlock(nil, nil, nil, YES); | 374 | completionBlock(nil, nil, nil, YES); |
375 | - } | ||
376 | - else { | 375 | + } else if (self.imageData) { |
377 | UIImage *image = [UIImage sd_imageWithData:self.imageData]; | 376 | UIImage *image = [UIImage sd_imageWithData:self.imageData]; |
378 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL]; | 377 | NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL]; |
379 | image = [self scaledImageForKey:key image:image]; | 378 | image = [self scaledImageForKey:key image:image]; |
@@ -390,6 +389,8 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis | @@ -390,6 +389,8 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis | ||
390 | else { | 389 | else { |
391 | completionBlock(image, self.imageData, nil, YES); | 390 | completionBlock(image, self.imageData, nil, YES); |
392 | } | 391 | } |
392 | + } else { | ||
393 | + completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}], YES); | ||
393 | } | 394 | } |
394 | } | 395 | } |
395 | self.completionBlock = nil; | 396 | self.completionBlock = nil; |
-
Please register or login to post a comment