Attempt to fix RCTImageLoader crash
Reviewed By: jspahrsummers Differential Revision: D2620944 fb-gh-sync-id: 39896c8aa6f162df5769afdd0f947acf4bb5cb76
This commit is contained in:
parent
b3cfc598ce
commit
8db1e1262e
|
@ -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]]) {
|
||||||
|
|
Loading…
Reference in New Issue