Add some security around wrongly typed URL argument

This commit is contained in:
Olivier Poitrey 2012-09-06 22:49:04 +02:00
parent 5f27d2d20d
commit 40524876e9
1 changed files with 4 additions and 0 deletions

View File

@ -123,6 +123,10 @@ static SDWebImageManager *instance;
{
url = [NSURL URLWithString:(NSString *)url];
}
else if (![url isKindOfClass:NSURL.class])
{
url = nil; // Prevent some common crashes due to common wrong values passed like NSNull.null for instance
}
if (!url || !delegate || (!(options & SDWebImageRetryFailed) && [failedURLs containsObject:url]))
{