Kaynağa Gözat

ignore empty contents

Gildas 7 yıl önce
ebeveyn
işleme
da34e48001
1 değiştirilmiş dosya ile 12 ekleme ve 6 silme
  1. 12 6
      lib/single-file/single-file-core.js

+ 12 - 6
lib/single-file/single-file-core.js

@@ -399,13 +399,19 @@ const SingleFileCore = (() => {
 							insertSingleFileComment: false,
 							insertSingleFileComment: false,
 							framesData: this.options.framesData
 							framesData: this.options.framesData
 						};
 						};
-						frameData.processor = new PageProcessor(options);
-						frameData.frameElement = frameElement;
-						await frameData.processor.loadPage(frameData.content);
-						return frameData.processor.initialize();
+						if (frameData.content) {
+							frameData.processor = new PageProcessor(options);
+							frameData.frameElement = frameElement;
+							await frameData.processor.loadPage(frameData.content);
+							return frameData.processor.initialize();
+						}
 					} else {
 					} else {
-						const pageData = await frameData.processor.getPageData();
-						frameElement.setAttribute("src", "data:text/html," + pageData.content);
+						if (frameData.processor) {
+							const pageData = await frameData.processor.getPageData();
+							frameElement.setAttribute("src", "data:text/html," + pageData.content);
+						} else {
+							frameElement.setAttribute("src", "about:blank");
+						}
 					}
 					}
 				} else {
 				} else {
 					frameElement.setAttribute("src", "about:blank");
 					frameElement.setAttribute("src", "about:blank");