From 0df12218b7b9a4c633d057158272a33df388ff58 Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Mon, 6 Jun 2016 12:10:51 +0300 Subject: [PATCH] Enabled CLANG_ANALYZER_NONNULL per http://indiestack.com/2016/06/nullable-edge-cases/. Small fix for a case where trying to get from a set using a nil key --- SDWebImage.xcodeproj/project.pbxproj | 2 ++ SDWebImage/SDWebImageManager.m | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index 1747cd6b..e30fc04e 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -1350,6 +1350,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1410,6 +1411,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index 6318e009..b213cec7 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -140,8 +140,10 @@ __weak SDWebImageCombinedOperation *weakOperation = operation; BOOL isFailedUrl = NO; - @synchronized (self.failedURLs) { - isFailedUrl = [self.failedURLs containsObject:url]; + if (url) { + @synchronized (self.failedURLs) { + isFailedUrl = [self.failedURLs containsObject:url]; + } } if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) {