braintree / popup-bridge-android

PopupBridge allows WebViews to open popup windows in a browser and send data back to the WebView
MIT License
53 stars 27 forks source link

NullPointerException in PopupBridge.runJavaScriptInWebView #25

Closed herbeth1u closed 4 years ago

herbeth1u commented 4 years ago

General information

Issue description

Hello. We've got some Crashlytics reports that appeared since we integrated PopupBridge in our application. Not reproduced on our own devices, but still affecting some of our users:

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.post(java.lang.Runnable)' on a null object reference
       at com.braintreepayments.popupbridge.PopupBridge.runJavaScriptInWebView(PopupBridge.java:100)
       at com.braintreepayments.popupbridge.PopupBridge.onBrowserSwitchResult(PopupBridge.java:153)
       at com.braintreepayments.browserswitch.BrowserSwitchFragment.onResume(BrowserSwitchFragment.java:73)
       at androidx.fragment.app.Fragment.performResume(Fragment.java:2747)
       at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:373)
       at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1199)
       at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1356)
       at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1434)
       at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1497)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2625)
       at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:2589)
       at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:269)
       at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:478)
       at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:467)
       at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:195)
       at android.app.Activity.performResume(Activity.java:7184)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3694)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3766)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2939)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1615)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:231)
       at android.app.ActivityThread.main(ActivityThread.java:6749)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Feel free to ask for more details. Thank you!

sshropshire commented 4 years ago

Hi @herbeth1u thanks for using the Braintree SDK for Android. Are a large percentage of your users experiencing this issue? It seems like the WebView reference becomes null at some point.

Are you able to provide steps to reproduce the issue?

herbeth1u commented 4 years ago

Hi @sshropshire, thanks for the quick reply. Only a small percentage of our users are affected by this crash (~1 for 10000 users). This is also why we haven't been able to reproduce the issue yet, so we can't provide steps to reproduce at the moment.

sshropshire commented 4 years ago

@herbeth1u I understand. Unfortunately, I'll have to close this issue for now until we can get some steps to reproduce on our end.

If you're able to get more information about this small subset of users to determine repro steps, feel free to create another issue and we'll take a look.