diff --git a/src/components/DataSync.svelte b/src/components/DataSync.svelte index 8231ee76..1cbbbeb3 100644 --- a/src/components/DataSync.svelte +++ b/src/components/DataSync.svelte @@ -122,7 +122,11 @@ const converted = convertTime(JSON.parse(remoteSave[key])); await updateSave(key, converted, true); } else { - await updateSave(key, JSON.parse(remoteSave[key]), true); + try { + await updateSave(key, JSON.parse(remoteSave[key]), true); + } catch (err) { + await updateSave(key, remoteSave[key], true); + } } } console.log('finished convert from google drive'); @@ -151,7 +155,11 @@ const converted = convertTime(JSON.parse(remoteSave[key])); await updateSave(key, converted, true); } else { - await updateSave(key, JSON.parse(remoteSave[key]), true); + try { + await updateSave(key, JSON.parse(remoteSave[key]), true); + } catch (err) { + await updateSave(key, remoteSave[key], true); + } } } else { await updateSave(key, remoteSave[key], true); diff --git a/src/stores/saveManager.js b/src/stores/saveManager.js index 462c851e..9e5b67ad 100644 --- a/src/stores/saveManager.js +++ b/src/stores/saveManager.js @@ -93,7 +93,11 @@ const convertSave = async () => { const converted = convertTime(JSON.parse(value)); await localforage.setItem(key, converted); } else { - await localforage.setItem(key, JSON.parse(value)); + try { + await localforage.setItem(key, JSON.parse(value)); + } catch (err) { + await localforage.setItem(key, value); + } } if (!key.endsWith('locale')) {