-
Notifications
You must be signed in to change notification settings - Fork 453
onActivityResult crashing when intent is null because promise is null #426
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
Comments
I've put together a PR that fixes the issue here: #427 would love to get this merged so we don't have to maintain a forked package! :D |
Hi, can you post here the full crash report of this issue? |
hello! this is the crash:
|
Hmm, interesting. How often do you see this crash? Maybe you have steps to reproduce this? We are also using this in production for one app and so far we haven't had any crashes related to this after the fix. However, I was able to find a single occurrence of similar crash as yours (the crash caused by promise being a reference to null, but the difference is that intent is not null) in our other app crashlogs, which is still using the react-native-app-auth v4.4.0. Since the intent is not null in this case, the crash happens on a different line where promise.reject is also called. Seems a bit strange though, since the onActivityResult is called when browser activity finishes and that browser activity can only be invoked by calling "authorize" method where the reference to promise is also set. |
So its very possible we have setup
I can constantly reproduce it :) Its very possible we are using Thanks for you help! |
Issue
This is related to the fix here: #352 and the initial issue here: #130
When
onActivityResult
is called (e.g. when returning to app from another app) the intent can be null. This triggers the following flow:react-native-app-auth/android/src/main/java/com/rnappauth/RNAppAuthModule.java
Lines 302 to 305 in cffea61
Which try's to do the following:
However if none of the other exported functions in this module are called then the
promise
instance variable is null. Because thepromise
is only set when the other functions are called. e.g.react-native-app-auth/android/src/main/java/com/rnappauth/RNAppAuthModule.java
Line 158 in cffea61
I think we should check if the promise is set before calling it in the
onActivityResult
function?cc @AlgirdasVZ @kadikraman
I'm going to play around with a fix since this is effecting us in a production app at the moment!
Environment
*
Android
no
5.0.0-rc3
The text was updated successfully, but these errors were encountered: