Skip to content
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

Prevent a crash when no cursor drawable is set #14789

Closed
wants to merge 2 commits into from

Conversation

gpeal
Copy link

@gpeal gpeal commented Jun 30, 2017

Summary

React Native 0.43 added additional functionality to setSelectionColor that also tints the cursor drawable of the View. However, some views may not have a cursor drawable set in which case, the code will crash when attempting to load a drawable with resource id 0.

We encountered this in our RN 0.45 upgrade in the Airbnb app.

@lelandrichardson

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Jun 30, 2017
@shergin
Copy link
Contributor

shergin commented Jul 13, 2017

Why should not 'catch' (try-catch) this exception as we catch others at the end of the function?

@gpeal
Copy link
Author

gpeal commented Jul 13, 2017

@shergin It's not really an exception. It's a valid state for it to be 0 so it would be counter intuitive to let it throw.

@gpeal
Copy link
Author

gpeal commented Jul 13, 2017

@shergin For the record, the exception that would be thrown is NotFoundException

@facebook-github-bot
Copy link
Contributor

@gpeal I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@stale
Copy link

stale bot commented Nov 14, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 14, 2017
@gpeal
Copy link
Author

gpeal commented Nov 21, 2017

@shergin bump

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 21, 2017
@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Nov 21, 2017
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shergin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

bowerman0 pushed a commit to bowerman0/react-native that referenced this pull request Dec 5, 2017
Summary:
React Native 0.43 added additional functionality to setSelectionColor that also tints the cursor drawable of the View. However, some views may not have a cursor drawable set in which case, the code will crash when attempting to load a drawable with resource id 0.

We encountered this in our RN 0.45 upgrade in the Airbnb app.

lelandrichardson
Closes facebook#14789

Differential Revision: D6386076

Pulled By: shergin

fbshipit-source-id: faa5a1edb3be8d08988f46205c0f22d17b63b5bc
bowerman0 pushed a commit to bowerman0/react-native that referenced this pull request Dec 5, 2017
Summary:
React Native 0.43 added additional functionality to setSelectionColor that also tints the cursor drawable of the View. However, some views may not have a cursor drawable set in which case, the code will crash when attempting to load a drawable with resource id 0.

We encountered this in our RN 0.45 upgrade in the Airbnb app.

lelandrichardson
Closes facebook#14789

Differential Revision: D6386076

Pulled By: shergin

fbshipit-source-id: faa5a1edb3be8d08988f46205c0f22d17b63b5bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants