aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
Diffstat (limited to 'src/background')
-rw-r--r--src/background/infrastructures/memory-storage.js6
-rw-r--r--src/background/usecases/operation.js4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/background/infrastructures/memory-storage.js b/src/background/infrastructures/memory-storage.js
index 234a9b8..3a7e4f2 100644
--- a/src/background/infrastructures/memory-storage.js
+++ b/src/background/infrastructures/memory-storage.js
@@ -10,6 +10,10 @@ export default class MemoryStorage {
}
get(name) {
- return JSON.parse(db[name]);
+ let data = db[name];
+ if (!data) {
+ return undefined;
+ }
+ return JSON.parse(data);
}
}
diff --git a/src/background/usecases/operation.js b/src/background/usecases/operation.js
index f19c632..86f39ca 100644
--- a/src/background/usecases/operation.js
+++ b/src/background/usecases/operation.js
@@ -183,7 +183,9 @@ export default class OperationInteractor {
onTabSelected(tabId) {
let lastId = this.cache.get(CURRENT_SELECTED_KEY);
- this.cache.set(LAST_SELECTED_KEY, lastId);
+ if (lastId) {
+ this.cache.set(LAST_SELECTED_KEY, lastId);
+ }
this.cache.set(CURRENT_SELECTED_KEY, tabId);
}
}