Skip to content

Commit

Permalink
show placeholder if downloaded data is not an image
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerabanes committed Oct 24, 2012
1 parent 9522274 commit dae7785
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion JMImageCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ - (void) _downloadAndWriteImageForURL:(NSURL *)url key:(NSString *)key completio
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *i = [[UIImage alloc] initWithData:data];

// stop process if the method could not initialize the image from the specified data
if (!i) return;

NSString *cachePath = cachePathForKey(key);
NSInvocation *writeInvocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(writeData:toPath:)]];

Expand Down

0 comments on commit dae7785

Please sign in to comment.