Authored by Bogdan Poplauschi

Merge pull request #1676 from jimmaye/background-crash-io10

#1619: Adds NSError as input to resourceValuesForKeys:error: method
@@ -504,10 +504,11 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -504,10 +504,11 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
504 // 2. Storing file attributes for the size-based cleanup pass. 504 // 2. Storing file attributes for the size-based cleanup pass.
505 NSMutableArray<NSURL *> *urlsToDelete = [[NSMutableArray alloc] init]; 505 NSMutableArray<NSURL *> *urlsToDelete = [[NSMutableArray alloc] init];
506 for (NSURL *fileURL in fileEnumerator) { 506 for (NSURL *fileURL in fileEnumerator) {
507 - NSDictionary<NSString *, id> *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:NULL]; 507 + NSError *error;
  508 + NSDictionary<NSString *, id> *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error];
508 509
509 - // Skip directories.  
510 - if ([resourceValues[NSURLIsDirectoryKey] boolValue]) { 510 + // Skip directories and errors.
  511 + if (error || [resourceValues[NSURLIsDirectoryKey] boolValue]) {
511 continue; 512 continue;
512 } 513 }
513 514