From e8a53f6b51e437e19b291cfde7c17caa1a64b12f Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Wed, 27 Sep 2023 20:48:01 +0300 Subject: [PATCH] catch error --- src/js/state/LocalStorageMemoryAdapter.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/state/LocalStorageMemoryAdapter.ts b/src/js/state/LocalStorageMemoryAdapter.ts index 1cb82e54d..1b352c886 100644 --- a/src/js/state/LocalStorageMemoryAdapter.ts +++ b/src/js/state/LocalStorageMemoryAdapter.ts @@ -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;