Committed by
GitHub
Merge pull request #2160 from dreampiggy/fix_zero_pixels
Fix that 0 pixels error should be used when width OR height is zero but not AND
Showing
1 changed file
with
2 additions
and
1 deletions
@@ -419,7 +419,8 @@ didReceiveResponse:(NSURLResponse *)response | @@ -419,7 +419,8 @@ didReceiveResponse:(NSURLResponse *)response | ||
419 | image = [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&imageData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(shouldScaleDown)}]; | 419 | image = [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&imageData options:@{SDWebImageCoderScaleDownLargeImagesKey: @(shouldScaleDown)}]; |
420 | } | 420 | } |
421 | } | 421 | } |
422 | - if (CGSizeEqualToSize(image.size, CGSizeZero)) { | 422 | + CGSize imageSize = image.size; |
423 | + if (imageSize.width == 0 || imageSize.height == 0) { | ||
423 | [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}]]; | 424 | [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}]]; |
424 | } else { | 425 | } else { |
425 | [self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES]; | 426 | [self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES]; |
-
Please register or login to post a comment