Skip to content

Commit 60d2ba0

Browse files
HeyImChrisChris Hogan
andauthored
Nil check our run loop thread (#771) (#772)
* Update RCTCxxBridge.mm * Update RCTCxxBridge.mm * run loop nil check Co-authored-by: Chris Hogan <[email protected]> Co-authored-by: Chris Hogan <[email protected]>
1 parent afc00d5 commit 60d2ba0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Libraries/WebSocket/RCTSRWebSocket.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,14 @@ - (void)_initializeStreams
530530
- (void)_connect
531531
{
532532
if (!_scheduledRunloops.count) {
533-
[self scheduleInRunLoop:[NSRunLoop RCTSR_networkRunLoop] forMode:NSDefaultRunLoopMode];
533+
// [TODO(macOS ISS#2323203): `scheduleInRunLoop:forMode:` takes in a non-null run loop parameter so let's be safe and verify that
534+
NSRunLoop *runLoop = [NSRunLoop RCTSR_networkRunLoop];
535+
if (runLoop != nil) {
536+
[self scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode];
537+
} else {
538+
RCTSRLog(@"Failed connecting to RCTSR_networkRunLoop");
539+
}
540+
// ]TODO(macOS ISS#2323203)
534541
}
535542

536543
[_outputStream open];

0 commit comments

Comments
 (0)