lampaa/com.lampa.startapp

crashes on onActivityResult

Opened this issue · 1 comments

Edmu commented

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 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, ios 5.1.1
com.lampa.startapp 6.1.6 "startApp"

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