Skip to content

Commit

Permalink
Nil check our run loop thread (#771) (#772)
Browse files Browse the repository at this point in the history
* Update RCTCxxBridge.mm

* Update RCTCxxBridge.mm

* run loop nil check

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>

Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
  • Loading branch information
HeyImChris and Chris Hogan committed May 14, 2021
1 parent afc00d5 commit 60d2ba0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Libraries/WebSocket/RCTSRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,14 @@ - (void)_initializeStreams
- (void)_connect
{
if (!_scheduledRunloops.count) {
[self scheduleInRunLoop:[NSRunLoop RCTSR_networkRunLoop] forMode:NSDefaultRunLoopMode];
// [TODO(macOS ISS#2323203): `scheduleInRunLoop:forMode:` takes in a non-null run loop parameter so let's be safe and verify that
NSRunLoop *runLoop = [NSRunLoop RCTSR_networkRunLoop];
if (runLoop != nil) {
[self scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode];
} else {
RCTSRLog(@"Failed connecting to RCTSR_networkRunLoop");
}
// ]TODO(macOS ISS#2323203)
}

[_outputStream open];
Expand Down

0 comments on commit 60d2ba0

Please sign in to comment.