Add some sanity check on the URL parameter

This commit is contained in:
Olivier Poitrey 2012-11-29 18:50:52 +01:00
parent 4284b5797e
commit ddd03f7d2c
1 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,12 @@
url = [NSURL URLWithString:(NSString *)url]; 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; __block SDWebImageCombinedOperation *operation = SDWebImageCombinedOperation.new;
if (!url || !completedBlock || (!(options & SDWebImageRetryFailed) && [self.failedURLs containsObject:url])) if (!url || !completedBlock || (!(options & SDWebImageRetryFailed) && [self.failedURLs containsObject:url]))