Skip to content

Commit

Permalink
Replacing SDWebImage#1018 - avoid warning "<Error>: ImageIO: CGImageS…
Browse files Browse the repository at this point in the history
…ourceCreateWithData data parameter is nil" if imageData is nil
  • Loading branch information
bpoplauschi committed Mar 19, 2015
1 parent 6e94724 commit 88ee3c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SDWebImage/SDWebImageDownloaderOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)aConnection {
if (completionBlock) {
if (self.options & SDWebImageDownloaderIgnoreCachedResponse && responseFromCached) {
completionBlock(nil, nil, nil, YES);
}
else {
} else if (self.imageData) {
UIImage *image = [UIImage sd_imageWithData:self.imageData];
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
image = [self scaledImageForKey:key image:image];
Expand All @@ -390,6 +389,8 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)aConnection {
else {
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;
Expand Down

0 comments on commit 88ee3c6

Please sign in to comment.