diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 65315a0b..acd5ee6a 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -508,7 +508,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error]; // Skip directories and errors. - if (error || [resourceValues[NSURLIsDirectoryKey] boolValue]) { + if (error || !resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) { continue; }