Replacing #1018 - avoid warning "<Error>: ImageIO: CGImageSourceCreateWithData data parameter is nil" if imageData is nil
This commit is contained in:
parent
6e947240a0
commit
88ee3c6774
|
@ -372,8 +372,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis
|
||||||
if (completionBlock) {
|
if (completionBlock) {
|
||||||
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
|
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
|
||||||
completionBlock(nil, nil, nil, YES);
|
completionBlock(nil, nil, nil, YES);
|
||||||
}
|
} else if (self.imageData) {
|
||||||
else {
|
|
||||||
UIImage *image = [UIImage sd_imageWithData:self.imageData];
|
UIImage *image = [UIImage sd_imageWithData:self.imageData];
|
||||||
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
|
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
|
||||||
image = [self scaledImageForKey:key image:image];
|
image = [self scaledImageForKey:key image:image];
|
||||||
|
@ -390,6 +389,8 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis
|
||||||
else {
|
else {
|
||||||
completionBlock(image, self.imageData, nil, YES);
|
completionBlock(image, self.imageData, nil, YES);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}], YES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.completionBlock = nil;
|
self.completionBlock = nil;
|
||||||
|
|
Loading…
Reference in New Issue