From 82752741542629824992d77dc55392f668a19766 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 2 Apr 2019 12:06:27 +0800 Subject: [PATCH] Fix the blacking error domain should filter specify SDWebImageErrorDomain codes which is indeed un-recoverable --- SDWebImage/SDWebImageManager.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index 4d72ef0d..409b07ab 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -178,7 +178,7 @@ static id _defaultImageLoader; // Query cache process - (void)callCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation - url:(nullable NSURL *)url + url:(nonnull NSURL *)url options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context progress:(nullable SDImageLoaderProgressBlock)progressBlock @@ -206,7 +206,7 @@ static id _defaultImageLoader; // Download process - (void)callDownloadProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation - url:(nullable NSURL *)url + url:(nonnull NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context cachedImage:(nullable UIImage *)cachedImage @@ -280,7 +280,7 @@ static id _defaultImageLoader; // Store cache process - (void)callStoreCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation - url:(nullable NSURL *)url + url:(nonnull NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context downloadedImage:(nullable UIImage *)downloadedImage @@ -375,7 +375,10 @@ static id _defaultImageLoader; shouldBlockFailedURL = [self.delegate imageManager:self shouldBlockFailedURL:url withError:error]; } else { // Filter the error domain and check error codes - if ([error.domain isEqualToString:NSURLErrorDomain]) { + if ([error.domain isEqualToString:SDWebImageErrorDomain]) { + shouldBlockFailedURL = ( error.code == SDWebImageErrorInvalidURL + || error.code == SDWebImageErrorBadImageData); + } else if ([error.domain isEqualToString:NSURLErrorDomain]) { shouldBlockFailedURL = ( error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut