Skip to content

Commit

Permalink
catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalmi committed Sep 27, 2023
1 parent 47efbb5 commit e8a53f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/js/state/LocalStorageMemoryAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export default class LocalStorageMemoryAdapter extends Adapter {
private loadFromLocalStorage() {
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i) as string;
const value = JSON.parse(localStorage.getItem(key) || '') as NodeValue;
let value;
try {
value = localStorage.getItem(key) || '';
value = JSON.parse(value);
} catch (e) {
// Ignore
}
this.storage.set(key, value);
}
this.isLoaded = true;
Expand Down

0 comments on commit e8a53f6

Please sign in to comment.