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

Crash in RNGooglePayModule on Firebase - onActivityResult NullPointerException #62

Open
SanjayVrize opened this issue Nov 14, 2024 · 0 comments

Comments

@SanjayVrize
Copy link

Hello Team,

I’m experiencing a crash in the RNGooglePayModule at com.busfor.RNGooglePayModule$1.onActivityResult, specifically related to the requestPaymentPromise object being null. The crash occurs when the onActivityResult method is triggered, and it tries to access requestPaymentPromise.reject(), resulting in a NullPointerException. This appears to be happening when the Google Pay activity result returns RESULT_CANCELED or RESULT_ERROR, and requestPaymentPromise hasn’t been set.

Caused by java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Promise.reject(java.lang.String, java.lang.String)' on a null object reference
at com.busfor.RNGooglePayModule$1.onActivityResult(RNGooglePayModule.java:xx)

Proposed Solution: To address this, I would suggest adding a null check for requestPaymentPromise within the onActivityResult method to avoid calling .reject() on a null reference. However, since this would require modifying the library code, it introduces maintenance risks and may not be ideal without your review.

Request: Could you please look into this issue? It would be great if a fix could be implemented, or if guidance could be provided on a recommended approach to handle this.

Caused by java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Promise.reject(java.lang.String, java.lang.String)' on a null object reference
at com.busfor.RNGooglePayModule$1.onActivityResult(RNGooglePayModule.java:63)
at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:338)
at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:821)
at com.facebook.react.ReactDelegate.onActivityResult(ReactDelegate.java:90)
at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:133)
at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:70)
at android.app.Activity.dispatchActivityResult(Activity.java:9139)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5973)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:6019)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2724)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:255)
at android.os.Looper.loop(Looper.java:364)
at android.app.ActivityThread.main(ActivityThread.java:8979)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1053)

Screenshot 2024-11-14 at 5 38 24 PM

Thank you

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

No branches or pull requests

1 participant