Polish the error description between image decode failed and image size is 0
This commit is contained in:
parent
16e2f6f6a1
commit
87f2418b0e
|
@ -474,7 +474,8 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
UIImage *image = SDImageLoaderDecodeImageData(imageData, self.request.URL, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context);
|
UIImage *image = SDImageLoaderDecodeImageData(imageData, self.request.URL, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context);
|
||||||
CGSize imageSize = image.size;
|
CGSize imageSize = image.size;
|
||||||
if (imageSize.width == 0 || imageSize.height == 0) {
|
if (imageSize.width == 0 || imageSize.height == 0) {
|
||||||
[self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}]];
|
NSString *description = image == nil ? @"Downloaded image decode failed" : @"Downloaded image has 0 pixels";
|
||||||
|
[self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : description}]];
|
||||||
} else {
|
} else {
|
||||||
[self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES];
|
[self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue