From dc5f3e209fdc37136b947145ef0f808946de0780 Mon Sep 17 00:00:00 2001 From: eight Date: Thu, 4 Oct 2018 19:34:36 +0800 Subject: [PATCH] Fix: settings could be empty on the first install --- js/prefs.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/prefs.js b/js/prefs.js index e3894b23..fbf59e30 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -103,7 +103,11 @@ var prefs = (() => { }; const initializing = promisify(chrome.storage.sync.get.bind(chrome.storage.sync))('settings') - .then(result => setAll(result.settings, true)); + .then(result => { + if (result.settings) { + setAll(result.settings, true); + } + }); chrome.storage.onChanged.addListener((changes, area) => { if (area !== 'sync' || !changes.settings || !changes.settings.newValue) {