From 899f8c1a82c762624a4c95584bf4780d280fe49a Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Thu, 6 Jul 2023 13:59:27 -0500 Subject: [PATCH] Fix error not being thrown --- data/GameManager.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/data/GameManager.js b/data/GameManager.js index da178bd..92fe869 100644 --- a/data/GameManager.js +++ b/data/GameManager.js @@ -139,13 +139,15 @@ class EJS_GameManager { } createCueFile(fileNames) { try { - fileNames = fileNames.sort((a, b) => { - return (parseInt(a.charAt()[0]) > parseInt(b.charAt()[0])) ? 1 : -1; - }) fileNames = fileNames.filter((item) => { return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin"].includes(item.split(".").pop().toLowerCase()); }) + fileNames = fileNames.sort((a, b) => { + if (isNaN(a.charAt()) || isNaN(b.charAt())) throw new Error("Incorrect file name format"); + return (parseInt(a.charAt()) > parseInt(b.charAt())) ? 1 : -1; + }) } catch(e) { + console.log(fileNames); if (fileNames.length > 1) { console.warn("Could not auto-create cue file(s)."); return null;