From c790d9fadff5534e299a09d192d5f0acd9e84ffb Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 26 Nov 2019 16:15:03 +0200 Subject: [PATCH] Ignore unknown settings --- client/js/store-settings.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/js/store-settings.js b/client/js/store-settings.js index 82d46365..f7c2278b 100644 --- a/client/js/store-settings.js +++ b/client/js/store-settings.js @@ -37,6 +37,11 @@ export function createSettingsStore(store) { const settingConfig = config[name]; + // Trying to update a non existing setting (e.g. server has an old key) + if (!settingConfig) { + return; + } + if ( sync === false && (state.syncSettings === false || settingConfig.sync === "never") @@ -64,7 +69,13 @@ export function createSettingsStore(store) { } function loadFromLocalStorage() { - const storedSettings = JSON.parse(storage.get("settings")) || false; + let storedSettings; + + try { + storedSettings = JSON.parse(storage.get("settings")); + } catch (e) { + storage.remove("settings"); + } if (!storedSettings) { return {};