[PermissionsAndroid] Prevent app from crashing when getCurrentActivity is null#10351
Closed
cmcewen wants to merge 2 commits into
Closed
[PermissionsAndroid] Prevent app from crashing when getCurrentActivity is null#10351cmcewen wants to merge 2 commits into
cmcewen wants to merge 2 commits into
Conversation
Contributor
|
By analyzing the blame information on this pull request, we identified @andreicoman11 and @mikelambert to be potential reviewers. |
Contributor
|
Thanks a lot! @facebook-github-bot shipit |
Contributor
|
Thanks for importing. If you are a Facebook employee, you can view this diff on Phabricator. |
Contributor
|
cc @grabbou can we cherry-pick this to the stable release? |
|
Hey guys, we're seeing a lot of crashes on Android and this should fix them. Could we get this commit in the 0.36 ? Thanks! |
Contributor
grabbou
pushed a commit
that referenced
this pull request
Oct 25, 2016
Summary: We're seeing a lot of crashes from `PermissionsModule` not being able to access the current activity, mentioned in #10009 and here: #9310 (comment) As far as I can tell, there is no way to ensure the Activity exists since the `ReactContext` holds a `WeakReference` to the current Activity and it appears that the lifecycle calls are happening in the right order (so not the same as #9310). This will at least allow people to catch the error in JS and update the UI or try again as opposed to crashing the app. I'm working on some bigger changes in #10221 but this is a smaller change and important to get fixed I think. Closes #10351 Differential Revision: D4010242 fbshipit-source-id: 7a76973bb2b3e45817d4283917740c89a10ec0b0
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
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.
We're seeing a lot of crashes from
PermissionsModulenot being able to access the current activity, mentioned in #10009 and here: #9310 (comment)As far as I can tell, there is no way to ensure the Activity exists since the
ReactContextholds aWeakReferenceto the current Activity and it appears that the lifecycle calls are happening in the right order (so not the same as #9310).This will at least allow people to catch the error in JS and update the UI or try again as opposed to crashing the app.
I'm working on some bigger changes in #10221 but this is a smaller change and important to get fixed I think.