From 854c2330ebe748eb0508bb788685232b6cff0022 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Thu, 8 Feb 2018 19:25:42 -0800 Subject: [PATCH] fixed blobmanager inserting nil when there's no mime type Summary: Upon handling symbolication response when a redbox occurs, the blob manager inserted `nil` mime type because the response header doesn't specify any. This crashed the app with exception: ``` *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[4]' terminating with uncaught exception of type NSException ``` Reviewed By: shergin Differential Revision: D6945632 fbshipit-source-id: 9298bd2674447106763c73e1a5035417bd30f29c --- Libraries/Blob/RCTBlobManager.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Libraries/Blob/RCTBlobManager.mm b/Libraries/Blob/RCTBlobManager.mm index 8d77cd5b15f553..aa45072553dcbe 100755 --- a/Libraries/Blob/RCTBlobManager.mm +++ b/Libraries/Blob/RCTBlobManager.mm @@ -13,6 +13,7 @@ #import #import +#import #import static NSString *const kBlobURIScheme = @"blob"; @@ -263,8 +264,8 @@ - (id)handleNetworkingResponse:(NSURLResponse *)response data:(NSData *)data @"blobId": [self store:data], @"offset": @0, @"size": @(data.length), - @"name": [response suggestedFilename], - @"type": [response MIMEType], + @"name": RCTNullIfNil([response suggestedFilename]), + @"type": RCTNullIfNil([response MIMEType]), }; }