diff --git a/shared/js/settings.ts b/shared/js/settings.ts index 8cf41ba5..a33b176f 100644 --- a/shared/js/settings.ts +++ b/shared/js/settings.ts @@ -1,10 +1,10 @@ -import {LogCategory, logError, logTrace} from "./log"; +import {LogCategory, logError, logInfo, logTrace} from "./log"; +import * as loader from "tc-loader"; import {Stage} from "tc-loader"; import {Registry} from "./events"; import {tr} from "./i18n/localize"; import {CallOnce, ignorePromise} from "tc-shared/proto"; import {getStorageAdapter} from "tc-shared/StorageAdapter"; -import * as loader from "tc-loader"; /* * TODO: Sync settings across renderer instances @@ -936,7 +936,12 @@ export class Settings { const json = await getStorageAdapter().get("settings.global"); try { - this.settingsCache = JSON.parse(json); + if(json === null) { + logInfo(LogCategory.GENERAL, tr("Found no settings. Creating new client settings.")); + this.settingsCache = {}; + } else { + this.settingsCache = JSON.parse(json); + } } catch(error) { this.settingsCache = {}; logError(LogCategory.GENERAL, tr("Failed to load global settings!\nJson: %s\nError: %o"), json, error); diff --git a/shared/js/update/UpdaterWeb.ts b/shared/js/update/UpdaterWeb.ts index 08da35c1..bcfc8025 100644 --- a/shared/js/update/UpdaterWeb.ts +++ b/shared/js/update/UpdaterWeb.ts @@ -140,7 +140,13 @@ class WebUpdater implements Updater { } getLastUsedVersion(): string { - return settings.getValue(Settings.KEY_UPDATER_LAST_USED_UI, undefined); + const result = settings.getValue(Settings.KEY_UPDATER_LAST_USED_UI, undefined); + if(result === undefined) { + this.updateUsedVersion(); + return this.getCurrentVersion(); + } + + return result; } updateUsedVersion() {