From ddd03f7d2cbd72880809eed36482aa188086df22 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Thu, 29 Nov 2012 18:50:52 +0100 Subject: [PATCH] Add some sanity check on the URL parameter --- SDWebImage/SDWebImageManager.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index cb38493b..ca86f768 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -69,6 +69,12 @@ url = [NSURL URLWithString:(NSString *)url]; } + // Prevents app crashing on argument type error like sending NSNull instead of NSURL + if (![url isKindOfClass:NSURL.class]) + { + url = nil; + } + __block SDWebImageCombinedOperation *operation = SDWebImageCombinedOperation.new; if (!url || !completedBlock || (!(options & SDWebImageRetryFailed) && [self.failedURLs containsObject:url]))