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

crashes on onActivityResult #138

Open
Edmu opened this issue Jan 21, 2020 · 1 comment
Open

crashes on onActivityResult #138

Edmu opened this issue Jan 21, 2020 · 1 comment

Comments

@Edmu
Copy link

Edmu commented Jan 21, 2020

It used to work fine but after some time (I guess due to cordova / cordova-android update or other reason)
it crashes on onActivityResult

some logs:

01-21 08:50:36.055 8646 8646 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity { ... MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.content.Intent.getExtras()' on a null object reference
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4342)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4385)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.ActivityThread.-wrap19(Unknown Source:0)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1657)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.os.Looper.loop(Looper.java:251)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6589)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.content.Intent.getExtras()' on a null object reference
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at com.lampa.startapp.startApp.onActivityResult(startApp.java:391)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:159)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:359)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:7235)
01-21 08:50:36.055 8646 8646 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4338)

it seems onActivityResult intent argument arrives as null

replacing

Bundle bundle = intent.getExtras();

with

Bundle bundle = intent == null ? null : intent.getExtras();

helps

Other info:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0, ios 5.1.1
com.lampa.startapp 6.1.6 "startApp"

@lampaa
Copy link
Owner

lampaa commented Jan 21, 2020

@Edmu thanks for the bug report! I will fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants