Browse Source

ensure there are URLs to replace when processing stylesheets

Gildas 7 years ago
parent
commit
ca44604862
1 changed files with 1 additions and 1 deletions
  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 + ")");