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

fix(android): Prevent crash in restoreInstanceState if bundleData is null #5289

Merged
merged 2 commits into from
Dec 2, 2021

Conversation

hermitdemschoenenleben
Copy link
Contributor

@hermitdemschoenenleben hermitdemschoenenleben commented Dec 2, 2021

this PR fixes this (closed) issue: ionic-team/capacitor-plugins#658
closes: #5290

Without the fix, capacitor calls the camera plugin's restoreState() method even though bundleData is null

@hermitdemschoenenleben
Copy link
Contributor Author

corresponding issue: #5290

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

I've made a few additions to make sure we don't save other data if we couldn't save the bundle and also to log error if the saving/restoring failed, since this will only prevent the crash, but the messages can maybe figure out why it's failing to save in the future.

@jcesarmobile jcesarmobile changed the title fix crash in restoreInstanceState if bundleData is null fix(android): Prevent crash in restoreInstanceState if bundleData is null Dec 2, 2021
@jcesarmobile jcesarmobile merged commit 622d62f into ionic-team:main Dec 2, 2021
@sebsoftpak
Copy link

Hi @hermitdemschoenenleben,

Thank you for making this fix. Do you know if this fix has been released?
(Haven't seen #658 in the release notes yet, that's why i'm asking.)

We are experiencing the same NullPointerException with @capacitor/camera 1.3.0.

Kind regards,
Sebastian Sørensen

@hermitdemschoenenleben
Copy link
Contributor Author

@sebsoftpak yes, the fix has been released (at least I don't see the error in production anymore)

@sebsoftpak
Copy link

@hermitdemschoenenleben ok, good to hear! will upgrade from 1.3.0 to 1.3.1, maybe that makes the difference :)

@jcesarmobile
Copy link
Member

The fix is in capacitor/android 3.3.3, not in the camera plugin

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

Successfully merging this pull request may close these issues.

bug + PR: Camera Plugin crashes app on restoreState (NullPointerException)
3 participants