diff --git a/js/components/Skin.js b/js/components/Skin.js index 0c0e416f..0c05f3ed 100644 --- a/js/components/Skin.js +++ b/js/components/Skin.js @@ -90,16 +90,20 @@ const Skin = props => { }); } }); - LETTERS.forEach(letter => { - const width = skinGenLetterWidths[`GEN_TEXT_${letter}`]; - const selectedWidth = skinGenLetterWidths[`GEN_LETTER_SELECTED_${letter}`]; - cssRules.push( - `#winamp2-js .gen-text-${letter.toLowerCase()} {width: ${width}px;}` - ); - cssRules.push( - `#winamp2-js .selected .gen-text-${letter.toLowerCase()} {width: ${selectedWidth}px;}` - ); - }); + + if (skinGenLetterWidths != null) { + LETTERS.forEach(letter => { + const width = skinGenLetterWidths[`GEN_TEXT_${letter}`]; + const selectedWidth = + skinGenLetterWidths[`GEN_LETTER_SELECTED_${letter}`]; + cssRules.push( + `#winamp2-js .gen-text-${letter.toLowerCase()} {width: ${width}px;}` + ); + cssRules.push( + `#winamp2-js .selected .gen-text-${letter.toLowerCase()} {width: ${selectedWidth}px;}` + ); + }); + } Object.keys(cursorSelectors).forEach(cursorName => { const cursorUrl = skinCursors[cursorName]; if (cursorUrl) { diff --git a/js/skinParser.js b/js/skinParser.js index 3bde036d..fe1aae0a 100644 --- a/js/skinParser.js +++ b/js/skinParser.js @@ -210,7 +210,7 @@ async function genRegion(zip) { async function genGenTextSprites(zip) { const img = await genImgFromFilename(zip, "GEN"); if (img == null) { - return {}; + return null; } const canvas = document.createElement("canvas"); @@ -263,7 +263,7 @@ async function skinParser(zipFile) { images, cursors, region, - [genLetterWidths, genTextImages] + genTextSprites ] = await Promise.all([ genColors(zip), genPlaylistStyle(zip), @@ -273,6 +273,8 @@ async function skinParser(zipFile) { genGenTextSprites(zip) ]); + const [genLetterWidths, genTextImages] = genTextSprites || [null, {}]; + return { colors, playlistStyle,