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

null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity #881

Closed
goguda opened this issue Apr 9, 2022 · 0 comments · Fixed by #846
Closed

null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity #881

goguda opened this issue Apr 9, 2022 · 0 comments · Fixed by #846

Comments

@goguda
Copy link

goguda commented Apr 9, 2022

Reposting since it's a more serious issue than I thought. Causing several crashes per day on all versions of Android.

Screenshot_20220408_143750

Same issue seems to occur at line 244 in StripeSdkModule.kt as well... null check needed here too?

I find it strange because based on visit logs I believe this is occurring without the user even interacting with any Stripe APIs yet, other than StripeProvider wrapping the root of the app.

Looking at line 244 of StripeSdkModule.kt...

(currentActivity as AppCompatActivity).supportFragmentManager.beginTransaction().add(paymentLauncherFragment, "payment_launcher_fragment").commit()

Taking a quick look at the internals of the library, my concern is, is a null check enough, or are null checks really just masking another problem? Should currentActivity ever actually be null in this case if the RN app has to be open for any of these API calls to even occur (as far as I know)?

Since currentActivity is null in the initialize method, if a null check was introduced and initialize was called while currentActivity was indeed null, would the Stripe SDK then be uninitialized in the RN app?

Wish I could get some more info on exactly what is causing it, but this is all I've got.

I'm using stripe-react-native v. 0.6.0, but it was happening in older versions as well.

Originally posted by @goguda in #844 (comment)

@goguda goguda changed the title ![Screenshot_20220408_143750](https://user-images.githubusercontent.com/26887502/162501761-4a17c156-68ae-4c98-9566-c686cf16e3f0.png) null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant