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

getValue causes crash if storage value is 'undefined' #3

Closed
crronem opened this issue May 18, 2021 · 0 comments · Fixed by #5
Closed

getValue causes crash if storage value is 'undefined' #3

crronem opened this issue May 18, 2021 · 0 comments · Fixed by #5
Assignees

Comments

@crronem
Copy link

crronem commented May 18, 2021

  getValue(key) {
        let value = browserStorage.getItem(key);
        if (value !== null) {
            value = JSON.parse(value);
        }
        return value;
    },

if value in storage is 'undefined' if (value !== null) is true and JSON.parse(value) causes crash.
There is no recovery from this without removing the storage value directly from the browser

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 a pull request may close this issue.

2 participants