From 31a87af0ab915e204420071f959a4b167d85d1eb Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 7 Jan 2018 19:55:05 +0800 Subject: [PATCH] Fix that 0 pixels error should be used when width OR height is zero but not AND --- SDWebImage/SDWebImageDownloaderOperation.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 8fdab376..f8057041 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -419,7 +419,8 @@ didReceiveResponse:(NSURLResponse *)response image = [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&imageData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(shouldScaleDown)}]; } } - if (CGSizeEqualToSize(image.size, CGSizeZero)) { + CGSize imageSize = image.size; + if (imageSize.width == 0 || imageSize.height == 0) { [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}]]; } else { [self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES];