Bladeren bron

fixed issue on franceinter.fr (fix #385)

Former-commit-id: 5a733ecd7fa2126f17116e00d1c9458f358abd13
Gildas 5 jaren geleden
bovenliggende
commit
56390d5596
1 gewijzigde bestanden met toevoegingen van 15 en 11 verwijderingen
  1. 15 11
      lib/single-file/modules/css-fonts-alt-minifier.js

+ 15 - 11
lib/single-file/modules/css-fonts-alt-minifier.js

@@ -215,18 +215,22 @@ this.singlefile.lib.modules.fontsAltMinifier = this.singlefile.lib.modules.fonts
 					source.valid = true;
 				} catch (error) {
 					const declarationFontURLs = fontURLs.get(srcDeclaration.data);
-					const fontURL = declarationFontURLs[declarationFontURLs.length - sourceIndex - 1];
-					if (fontURL) {
-						const fontFace = new FontFace("test-font", "url(" + fontURL + ")");
-						try {
-							await Promise.race(
-								[
-									fontFace.load().then(() => fontFace.loaded).then(() => source.valid = true),
-									new Promise(resolve => setTimeout.call(window, () => { source.valid = true; resolve(); }, FONT_MAX_LOAD_DELAY))
-								]);
-						} catch (error) {
-							// ignored
+					if (declarationFontURLs) {
+						const fontURL = declarationFontURLs[declarationFontURLs.length - sourceIndex - 1];
+						if (fontURL) {
+							const fontFace = new FontFace("test-font", "url(" + fontURL + ")");
+							try {
+								await Promise.race(
+									[
+										fontFace.load().then(() => fontFace.loaded).then(() => source.valid = true),
+										new Promise(resolve => setTimeout.call(window, () => { source.valid = true; resolve(); }, FONT_MAX_LOAD_DELAY))
+									]);
+							} catch (error) {
+								// ignored
+							}
 						}
+					} else {
+						source.valid = true;
 					}
 				}
 			} else {