Skip to content

Commit

Permalink
check if string is parsable
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidely committed May 3, 2024
1 parent a82a11d commit ef5d858
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion resources/scripts/ext.networknotice.Notice.js
Expand Up @@ -24,7 +24,11 @@

function getItemsFromStorage() {
const items = localStorage.getItem( LOCAL_STORAGE_KEY );
return items ? JSON.parse( items ) : [ ];
try {
return items ? JSON.parse( items ) : [];
} catch( e ) {
return [ ];
}
}

function putIntoStorage( key ) {
Expand Down

0 comments on commit ef5d858

Please sign in to comment.