From a2a48f6ed9a70c49cfc57e681aaded76ad8e7660 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Tue, 3 Feb 2026 19:55:30 -0500 Subject: [PATCH] Fix Map to Local button when artists array is empty - Safely handle empty or undefined artists array - Prevents 'expected expression, got }' JavaScript error - Also fixed artists display to handle undefined arrays --- allstarr/wwwroot/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index 105f5a9..e33f7ed 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -1618,7 +1618,9 @@ // Use JSON.stringify to properly escape strings for JavaScript const escapedName = JSON.stringify(name); const escapedTitle = JSON.stringify(t.title || ''); - const escapedArtist = JSON.stringify((t.artists && t.artists[0]) || ''); + // Safely get first artist, defaulting to empty string + const firstArtist = (t.artists && t.artists.length > 0) ? t.artists[0] : ''; + const escapedArtist = JSON.stringify(firstArtist); const escapedSpotifyId = JSON.stringify(t.spotifyId || ''); mapButton = ``; } @@ -1628,7 +1630,7 @@ ${t.position + 1}

${escapeHtml(t.title)}${statusBadge}${mapButton}

- ${escapeHtml(t.artists.join(', '))} + ${escapeHtml((t.artists || []).join(', '))}
${t.album ? escapeHtml(t.album) : ''}