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

NullPointerException when trying to get new instance of BraintreeFragment #125

Closed
MiralDesai opened this issue Oct 28, 2016 · 6 comments
Closed

Comments

@MiralDesai
Copy link

MiralDesai commented Oct 28, 2016

A crash being reported to me:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Handler android.app.FragmentHostCallback.getHandler()' on a null object reference

Full stacktrace:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Handler android.app.FragmentHostCallback.getHandler()' on a null object reference
       at android.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1530)
       at android.app.BackStackRecord.commitNow(BackStackRecord.java:681)
       at com.braintreepayments.api.BraintreeFragment.newInstance(SourceFile:157)
       at com.app.activity.AddPaymentMethod.initialiseBraintreeFragment(SourceFile:185)
       at com.app.activity.AddPaymentMethod.access$1200(SourceFile:66)
       at android.os.AsyncTask.finish(AsyncTask.java:660)
       at android.os.AsyncTask.-wrap1(AsyncTask.java)
       at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:677)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6077)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Not happening on my side since this is all within one method (initialiseBraintreeFragment()) which is setup exactly as the braintree docs suggest.

Could you guys look into this? Thanks. v2.3.10 of the Braintree SDK

@lkorth
Copy link
Member

lkorth commented Oct 28, 2016

This is on API 24 or above correct? Can you confirm if this is being run on that main thread or a background thread?

@MiralDesai
Copy link
Author

API 24 correct. It's being run on the main thread.

@MiralDesai
Copy link
Author

Any updates on this?

@lkorth
Copy link
Member

lkorth commented Nov 1, 2016

@MiralDesai: it doesn't look like there is a fix for this, only a work around. We're reviewing the work around and will push it soon.

@MiralDesai
Copy link
Author

MiralDesai commented Nov 2, 2016

Fair enough. Will look out for it.

@lkorth lkorth closed this as completed in 9ed73b4 Nov 3, 2016
@lkorth
Copy link
Member

lkorth commented Nov 3, 2016

Thanks for the report, the fix will go out in the next release.

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

2 participants