Skip to content

Commit

Permalink
Add some security around wrongly typed URL argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Poitrey committed Sep 6, 2012
1 parent 5f27d2d commit 4052487
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SDWebImage/SDWebImageManager.m
Expand Up @@ -123,6 +123,10 @@ - (void)downloadWithURL:(NSURL *)url delegate:(id<SDWebImageManagerDelegate>)del
{
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]))
{
Expand Down

0 comments on commit 4052487

Please sign in to comment.