Skip to content

Commit

Permalink
catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalmi committed Jan 4, 2024
1 parent 77d48ae commit 4524569
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 4524569

Please sign in to comment.