Przeglądaj źródła

verify the presence of content property

Gildas 7 lat temu
rodzic
commit
fc2fdc002b
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      lib/single-file/single-file-core.js

+ 4 - 4
lib/single-file/single-file-core.js

@@ -503,11 +503,11 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			this.options.title = titleElement ? titleElement.textContent.trim() : "";
 			this.options.infobarContent = await ProcessorHelper.evalTemplate(this.options.infobarTemplate, this.options, null, true);
 			this.options.info = {
-				description: descriptionElement ? descriptionElement.content.trim() : "",
+				description: descriptionElement && descriptionElement.content ? descriptionElement.content.trim() : "",
 				lang: this.doc.documentElement.lang,
-				author: authorElement ? authorElement.content.trim() : "",
-				creator: creatorElement ? creatorElement.content.trim() : "",
-				publisher: publisherElement ? publisherElement.content.trim() : ""
+				author: authorElement && authorElement.content ? authorElement.content.trim() : "",
+				creator: creatorElement && creatorElement.content ? creatorElement.content.trim() : "",
+				publisher: publisherElement && publisherElement.content ? publisherElement.content.trim() : ""
 			};
 		}