Browse files

[Issue #308] Fixing crash caused by attempting to cache invalid or ni…

…l image
  • Loading branch information...
1 parent 94d6a6c commit 9adb586a82bba2592df1f40f3c8c73d192b3d0fd @mattt mattt committed Apr 19, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 AFNetworking/UIImageView+AFNetworking.m
View
4 AFNetworking/UIImageView+AFNetworking.m
@@ -172,7 +172,9 @@ - (UIImage *)cachedImageForRequest:(NSURLRequest *)request {
- (void)cacheImage:(UIImage *)image
forRequest:(NSURLRequest *)request
{
- [self setObject:image forKey:AFImageCacheKeyFromURLRequest(request)];
+ if (image && request) {
+ [self setObject:image forKey:AFImageCacheKeyFromURLRequest(request)];
+ }
}
@end

0 comments on commit 9adb586

Please sign in to comment.