ソースを参照

make sure options is defined

Gildas 5 年 前
コミット
887abffe37
1 ファイル変更7 行追加5 行削除
  1. 7 5
      extension/core/bg/autosave.js

+ 7 - 5
extension/core/bg/autosave.js

@@ -42,12 +42,14 @@ singlefile.extension.core.bg.autosave = (() => {
 		if (message.method.endsWith(".save")) {
 			const tabId = sender.tab.id;
 			const options = await singlefile.extension.core.bg.config.getOptions(sender.tab.url, true);
-			if (options.autoClose) {
-				singlefile.extension.core.bg.tabs.remove(tabId);
+			if (options) {
+				if (options.autoClose) {
+					singlefile.extension.core.bg.tabs.remove(tabId);
+				}
+				ui.onStart(tabId, 1, true);
+				await saveContent(message, sender.tab);
+				ui.onEnd(tabId, true);
 			}
-			ui.onStart(tabId, 1, true);
-			await saveContent(message, sender.tab);
-			ui.onEnd(tabId, true);
 			return {};
 		}
 	}