From 4290dbf356d44bb52f6a7d06aa50d6c6a8fe1d63 Mon Sep 17 00:00:00 2001 From: retroNUC <71151161+retroNUC@users.noreply.github.com> Date: Fri, 10 Mar 2023 09:20:24 +0000 Subject: [PATCH] Update score.js for records no longer in music_db (#3) Quick guard matching other functions to stop getReleaseDate() from failing --- sdvx@asphyxia/webui/asset/js/score.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sdvx@asphyxia/webui/asset/js/score.js b/sdvx@asphyxia/webui/asset/js/score.js index d5e8a49..b8feaeb 100644 --- a/sdvx@asphyxia/webui/asset/js/score.js +++ b/sdvx@asphyxia/webui/asset/js/score.js @@ -20,6 +20,9 @@ function getReleaseDate(musicid) { //console.log(music_db["mdb"]["music"]) //console.log(musicid+" "+type); var result = music_db["mdb"]["music"].filter(object => object["@id"] == musicid); + if (result.length == 0) { + return "Unknown"; + } return result[0]["info"]["distribution_date"]["#text"] //console.log(result); } @@ -286,4 +289,4 @@ $(document).ready(function() { }); -}) \ No newline at end of file +})