Skip to content

Commit

Permalink
fixed blobmanager inserting nil when there's no mime type
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fkgozali authored and facebook-github-bot committed Feb 9, 2018
1 parent fa0ac92 commit 854c233
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Libraries/Blob/RCTBlobManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#import <React/RCTConvert.h>
#import <React/RCTNetworking.h>
#import <React/RCTUtils.h>
#import <React/RCTWebSocketModule.h>

static NSString *const kBlobURIScheme = @"blob";
Expand Down Expand Up @@ -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]),
};
}

Expand Down

0 comments on commit 854c233

Please sign in to comment.