You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
β― npx cap doctor
π Capacitor Doctor π
Latest Dependencies:
@capacitor/cli: 3.3.2
@capacitor/core: 3.3.2
@capacitor/android: 3.3.2
@capacitor/ios: 3.3.2
Installed Dependencies:
@capacitor/cli: 3.3.2
@capacitor/core: 3.3.2
@capacitor/android: 3.3.2
@capacitor/ios: 3.3.2
Platform(s)
android
Current Behavior
Roughly 5 % of our android users that try to pick an image (or multiple images) see this crash:
java.lang.NullPointerException:
at com.capacitorjs.plugins.camera.CameraPlugin.restoreState (CameraPlugin.java:721)
at com.getcapacitor.Bridge.restoreInstanceState (Bridge.java:811)
at com.getcapacitor.Bridge$Builder.create (Bridge.java:1286)
at com.getcapacitor.BridgeActivity.load (BridgeActivity.java:72)
at com.getcapacitor.BridgeActivity.onStart (BridgeActivity.java:110)
at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1435)
at android.app.Activity.performStart (Activity.java:8231)
at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3861)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2325)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8633)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Expected Behavior
App should not crash.
Code Reproduction
I was not able to reproduce the bug, but reading the code it appears evident that there is a problem:
When capacitor tries to restoreInstanceState() it fetches Bundle bundleData = savedInstanceState.getBundle(BUNDLE_PLUGIN_CALL_BUNDLE_KEY);
It does not perform a null check and passes it to the camera plugin's restoreState which uses it without a null check
Looking at the camera plugin's saveInstanceState (and super.saveInstanceState) it is clear that sometimes bundleData is going to be null, leading to the crash
The text was updated successfully, but these errors were encountered:
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Bug Report
This is essentially the same bug as ionic-team/capacitor-plugins#658 , this time with a pull request that fixes the issue: #5289
Capacitor Version
Platform(s)
android
Current Behavior
Roughly 5 % of our android users that try to pick an image (or multiple images) see this crash:
Expected Behavior
App should not crash.
Code Reproduction
I was not able to reproduce the bug, but reading the code it appears evident that there is a problem:
restoreInstanceState()
it fetchesBundle bundleData = savedInstanceState.getBundle(BUNDLE_PLUGIN_CALL_BUNDLE_KEY);
null
check and passes it to the camera plugin'srestoreState
which uses it without anull
checksaveInstanceState
(andsuper.saveInstanceState
) it is clear that sometimesbundleData
is going to be null, leading to the crashThe text was updated successfully, but these errors were encountered: