forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 162
Check a nil URL to fix crashes connecting to socket #785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merge upstream into fork
harrieshin
approved these changes
May 28, 2021
|
HeyImChris
added a commit
to HeyImChris/react-native-macos
that referenced
this pull request
May 28, 2021
* Update RCTCxxBridge.mm * Update RCTCxxBridge.mm * nil check websocket URL * use RCTAssertParam Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
HeyImChris
added a commit
to HeyImChris/react-native-macos
that referenced
this pull request
May 28, 2021
* Update RCTCxxBridge.mm * Update RCTCxxBridge.mm * nil check websocket URL * use RCTAssertParam Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
HeyImChris
added a commit
that referenced
this pull request
Jun 1, 2021
* Check a nil URL to fix crashes connecting to socket (#785) * Update RCTCxxBridge.mm * Update RCTCxxBridge.mm * nil check websocket URL * use RCTAssertParam Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local> * disable hermes Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
HeyImChris
added a commit
that referenced
this pull request
Jun 1, 2021
* Add nullability checks (#704) * Update RCTCxxBridge.mm * add nullability checks * Check a nil URL to fix crashes connecting to socket (#785) * Update RCTCxxBridge.mm * Update RCTCxxBridge.mm * nil check websocket URL * use RCTAssertParam Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local> * pod install Co-authored-by: Chris Hogan <chrishogan@Chriss-MacBook-Pro-2.local>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary
We're seeing crashes because a nil URL is passed in here. We're investigating the root cause of who is passing in nil, but we can also be better at graciously handling an invalid URL. Instead of crashing, let's assert and skip the websocket connection.
After this goes into master I can cherry-pick into our stable branches.
Changelog
[Apple] [Bug] - Nil check nil websocket URL
Test Plan
I can't repro this failure myself, but we've gotten reports of it. A simple nil check and assert should at least prevent crashes. I did the basic due diligence of verifying with the API that it requires a non-null parameter and will throw an exception if we pass in nil.