AppAuth-Android: NPE on AuthorizationManagementActivity.onResume (from Android framework?)
I can’t reproduce it myself, but on an app with around half million active users it’s happening on production from time to time. (we are using the latest AppAuth version 0.7.0).
Usually happening on these devices:
- Huawei 荣耀5X (HNKIW-Q) [Android 6.0]
- Galaxy TabS 10.5 (chagalllte) [Android 6.0]
- Gigaset GS170 (GS170) [Android 7.0]
- Galaxy J1 (j13g) [Android 4.4]
- Samsung Galaxy S5 mini (kminilte) [Android 6.0]
NPE:
java.lang.NullPointerException: android.app.Instrumentation in Attempt to invoke virtual method ‘boolean android.content.Intent.migrateExtraStreamToClipData()’ on a null object reference.execStartActivity
Stack trace:
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4225)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.migrateExtraStreamToClipData()' on a null object reference
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1534)
at android.app.Activity.startActivityForResult(Activity.java:4298)
at android.app.Activity.startActivityForResult(Activity.java:4245)
at android.app.Activity.startActivity(Activity.java:4582)
at android.app.Activity.startActivity(Activity.java:4550)
at net.openid.appauth.AuthorizationManagementActivity.onResume(AuthorizationManagementActivity.java)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1287)
at android.app.Activity.performResume(Activity.java:7015)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4214)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 15 (1 by maintainers)
Commits related to this issue
- fix #318 NPE on AuthorizationManagementActivity.onResume — committed to phusung/AppAuth-Android by phusung 6 years ago
Hi, I believe I found the cause for this crash:
It occurs when you open the authorization request twice in a row (e.g. double-clicking your app’s login button which calls the AppAuth SDK twice via “performAuthorizationRequest” or “getAuthorizationRequestIntent”). The crash occurs after completing the login process and it tries to return back to your app.
I am temporarily fixing this issue by adding a boolean in my app to determine if the authorization is occurring already.
Our tester has managed to reproduce this problem. This happens if the user interrupts the flow, by following steps:
Stacktrace from our reproduction: