diff --git a/src/js/storage.js b/src/js/storage.js index 8dc5ba85b0..bd78a67573 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -84,8 +84,13 @@ function BadgerPen(callback) { // initialize from extension local storage chrome.storage.local.get(self.KEYS, function (store) { + let storage_err; + if (chrome.runtime.lastError) { + storage_err = chrome.runtime.lastError.message; + } + self.KEYS.forEach(key => { - if (utils.hasOwn(store, key)) { + if (store && utils.hasOwn(store, key)) { self[key] = new BadgerStorage(key, store[key]); } else { let storageObj = new BadgerStorage(key, {}); @@ -94,6 +99,14 @@ function BadgerPen(callback) { } }); + if (!store || storage_err) { + console.error("Error reading from extension storage:", storage_err); + if (!store) { + self.settings_map.setItem("showIntroPage", false); + self.settings_map.setItem("seenComic", true); + } + } + badger.initSettings(); if (!chrome.storage.managed) {