From 5f0594f043f13a3b4703b28bf72ccf60b4237e74 Mon Sep 17 00:00:00 2001 From: initlife Date: Wed, 30 Sep 2015 10:58:17 +0800 Subject: [PATCH] don't to perform download if url is "" but not nil sometimes user may pass @"" as url to sdwebimage to download, now it will also run NSURLConnection and try to download, actually there is no need to do this. I think maybe use url.absoluteString.length == 0 to avoid that url is not nil but a empty string will be better --- SDWebImage/SDWebImageManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index 9c42888b..780b7c84 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -133,7 +133,7 @@ isFailedUrl = [self.failedURLs containsObject:url]; } - if (!url || (!(options & SDWebImageRetryFailed) && isFailedUrl)) { + if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) { dispatch_main_sync_safe(^{ NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil]; completedBlock(nil, error, SDImageCacheTypeNone, YES, url);