Attempt to fix RCTImageLoader crash

Reviewed By: jspahrsummers

Differential Revision: D2620944

fb-gh-sync-id: 39896c8aa6f162df5769afdd0f947acf4bb5cb76
This commit is contained in:
Nick Lockwood 2015-11-05 09:06:53 -08:00 committed by facebook-github-bot-5
parent b3cfc598ce
commit 8db1e1262e
1 changed files with 10 additions and 1 deletions

View File

@ -224,7 +224,16 @@ RCT_EXPORT_MODULE()
__weak RCTImageLoader *weakSelf = self; __weak RCTImageLoader *weakSelf = self;
__block RCTImageLoaderCancellationBlock decodeCancel = nil; __block RCTImageLoaderCancellationBlock decodeCancel = nil;
RCTURLRequestCompletionBlock processResponse = RCTURLRequestCompletionBlock processResponse =
^(NSURLResponse *response, NSData *data, __unused NSError *error) { ^(NSURLResponse *response, NSData *data, NSError *error) {
// Check for system errors
if (error) {
completionHandler(error, nil);
return;
} else if (!data) {
completionHandler(RCTErrorWithMessage(@"Unknown image download error"), nil);
return;
}
// Check for http errors // Check for http errors
if ([response isKindOfClass:[NSHTTPURLResponse class]]) { if ([response isKindOfClass:[NSHTTPURLResponse class]]) {