Fix crash in RCTBlobManager in bridgeless mode

Summary:
When bridge is nil, RCTBlobManager crashes with `EXC_BAD_ACCESS`.

The fix: instead of using the bridge to find RCTNetworking, use TM lookup delegate.

Changelog: [iOS][Internal] Fix crash in RCTBlobManager in bridgeless mode

Reviewed By: mdvacca

Differential Revision: D19320136

fbshipit-source-id: 49aabb3ce53b2ec620fcc02be1c6c1b44066f440
This commit is contained in:
Peter Argany 2020-01-13 22:52:07 -08:00 коммит произвёл Facebook Github Bot
Родитель a6c0f5a120
Коммит 12f78f145a
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -38,6 +38,7 @@ RCT_EXPORT_MODULE(BlobModule)
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
@synthesize turboModuleLookupDelegate = _turboModuleLookupDelegate;
- (void)setBridge:(RCTBridge *)bridge
{
@ -139,9 +140,11 @@ RCT_EXPORT_MODULE(BlobModule)
RCT_EXPORT_METHOD(addNetworkingHandler)
{
dispatch_async(_bridge.networking.methodQueue, ^{
[self->_bridge.networking addRequestHandler:self];
[self->_bridge.networking addResponseHandler:self];
RCTNetworking *const networking = _bridge ? _bridge.networking : [_turboModuleLookupDelegate moduleForName:"RCTNetworking"];
dispatch_async(networking.methodQueue, ^{
[networking addRequestHandler:self];
[networking addResponseHandler:self];
});
}