Fix undefined artists array causing syntax error

This commit is contained in:
2026-02-03 19:46:48 -05:00
parent 17560f0d34
commit c1c2212b53

View File

@@ -1585,9 +1585,9 @@
// Add manual map button for external tracks
// 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[0] || '');
const escapedSpotifyId = JSON.stringify(t.spotifyId);
const escapedTitle = JSON.stringify(t.title || '');
const escapedArtist = JSON.stringify((t.artists && t.artists[0]) || '');
const escapedSpotifyId = JSON.stringify(t.spotifyId || '');
mapButton = `<button class="small" onclick="openManualMap(${escapedName}, ${t.position}, ${escapedTitle}, ${escapedArtist}, ${escapedSpotifyId})" style="margin-left:8px;font-size:0.75rem;padding:4px 8px;">Map to Local</button>`;
}