Skip to content

Commit dd18476

Browse files
committed
fix(ios) fix crash on WebSocket errors
Bacckport facebook/react-native@748aa13 Fixes: ~~~ Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x129708 __exceptionPreprocess 1 libobjc.A.dylib 0x287a8 objc_exception_throw 2 CoreFoundation 0x19b9c8 -[__NSCFString characterAtIndex:].cold.1 3 CoreFoundation 0x1a7a20 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 4 CoreFoundation 0x164c0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] 5 CoreFoundation 0x8de0 +[NSDictionary dictionaryWithObjects:forKeys:count:] 6 JitsiMeetSDK 0x5704b4 -[RCTWebSocketModule webSocket:didFailWithError:] + 168 (RCTWebSocketModule.m:168) 7 JitsiMeetSDK 0x54a5ec __33-[RCTSRWebSocket _failWithError:]_block_invoke_2 + 622 (RCTSRWebSocket.m:622) 8 libdispatch.dylib 0x2a84 _dispatch_call_block_and_release 9 libdispatch.dylib 0x481c _dispatch_client_callout 10 libdispatch.dylib 0xc004 _dispatch_lane_serial_drain 11 libdispatch.dylib 0xcc00 _dispatch_lane_invoke 12 libdispatch.dylib 0x174bc _dispatch_workloop_worker_thread 13 libsystem_pthread.dylib 0x37a4 _pthread_wqthread 14 libsystem_pthread.dylib 0xa74c start_wqthread ~~~
1 parent cfde918 commit dd18476

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

patches/react-native+0.61.5-jitsi.2.patch

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
diff --git a/node_modules/react-native/Libraries/WebSocket/RCTWebSocketModule.m b/node_modules/react-native/Libraries/WebSocket/RCTWebSocketModule.m
2+
index d9387c4..a487da0 100644
3+
--- a/node_modules/react-native/Libraries/WebSocket/RCTWebSocketModule.m
4+
+++ b/node_modules/react-native/Libraries/WebSocket/RCTWebSocketModule.m
5+
@@ -165,10 +165,10 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
6+
NSNumber *socketID = [webSocket reactTag];
7+
_contentHandlers[socketID] = nil;
8+
_sockets[socketID] = nil;
9+
- [self sendEventWithName:@"websocketFailed" body:@{
10+
- @"message": error.localizedDescription,
11+
- @"id": socketID
12+
- }];
13+
+ NSDictionary *body =
14+
+ @{@"message" : error.localizedDescription ?: @"Undefined, error is nil",
15+
+ @"id" : socketID ?: @(-1)};
16+
+ [self sendEventWithName:@"websocketFailed" body:body];
17+
}
18+
19+
- (void)webSocket:(RCTSRWebSocket *)webSocket
120
diff --git a/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm b/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
221
index bd48f44..d243ed0 100644
322
--- a/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm

0 commit comments

Comments
 (0)