Преглед изворни кода

ensure there are URLs to replace when processing stylesheets

Gildas пре 7 година
родитељ
комит
ca44604862
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      lib/single-file/single-file-core.js

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

@@ -987,7 +987,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 					const dataURI = await batchRequest.addURL(resourceURL);
 					if (!inline && options.compressCSS && dataURI.startsWith(PREFIX_DATA_URI_IMAGE) && !dataURI.startsWith(PREFIX_DATA_URI_IMAGE_SVG)) {
 						const functions = stylesheetContent.match(DomUtil.getRegExp(urlFunction));
-						if (functions.length > 1) {
+						if (functions && functions.length > 1) {
 							const variableName = "--single-file-" + indexStyle + "-" + indexVariable;
 							stylesheetContent = variableName + ":url(\"" + dataURI + "\")" + (indexVariable ? ";" : "}") + stylesheetContent;
 							stylesheetContent = stylesheetContent.replace(DomUtil.getRegExp(urlFunction), "var(" + variableName + ")");