Skip to content

Commit 854c233

Browse files
fkgozalifacebook-github-bot
authored andcommitted
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
1 parent fa0ac92 commit 854c233

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Libraries/Blob/RCTBlobManager.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#import <React/RCTConvert.h>
1515
#import <React/RCTNetworking.h>
16+
#import <React/RCTUtils.h>
1617
#import <React/RCTWebSocketModule.h>
1718

1819
static NSString *const kBlobURIScheme = @"blob";
@@ -263,8 +264,8 @@ - (id)handleNetworkingResponse:(NSURLResponse *)response data:(NSData *)data
263264
@"blobId": [self store:data],
264265
@"offset": @0,
265266
@"size": @(data.length),
266-
@"name": [response suggestedFilename],
267-
@"type": [response MIMEType],
267+
@"name": RCTNullIfNil([response suggestedFilename]),
268+
@"type": RCTNullIfNil([response MIMEType]),
268269
};
269270
}
270271

0 commit comments

Comments
 (0)