From d86f20705c0e76060031dbaad043c9dec11ff611 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Thu, 16 Nov 2017 18:17:32 -0800 Subject: [PATCH] Handle corrupt PLEDIT.txt files --- js/skinParser.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/skinParser.js b/js/skinParser.js index a99b255c..0151284a 100644 --- a/js/skinParser.js +++ b/js/skinParser.js @@ -149,14 +149,19 @@ const defaultPlaylistStyle = { async function genPlaylistStyle(zip) { const pleditContent = await genFileFromZip(zip, "PLEDIT", "txt", "text"); - const data = pleditContent - ? parseIni(pleditContent).text - : defaultPlaylistStyle; + const data = pleditContent && parseIni(pleditContent).text; + if (!data) { + // Corrupt or missing PLEDIT.txt file. + return defaultPlaylistStyle; + } // Winamp seems to permit colors that contain too many characters. // For compatibility with existing skins, we normalize them here. ["normal", "current", "normalbg", "selectedbg"].forEach(colorKey => { let color = data[colorKey]; + if (!color) { + return; + } if (color[0] !== "#") { color = `#${color}`; }