From aac6e7cccf2f4cbbd04b841fff0dc3aa69f8cd2f Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Tue, 28 Nov 2023 11:31:33 +0100 Subject: [PATCH] Fix index out of range error in np. --- icedreammusic/np/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/icedreammusic/np/main.go b/icedreammusic/np/main.go index 6531552..6a6b1b1 100644 --- a/icedreammusic/np/main.go +++ b/icedreammusic/np/main.go @@ -187,8 +187,10 @@ func main() { go func() { // enrich metadata with metacollector req := metacollector.MetaCollectorRequest{ - Artist: tunaMetadata.Artists[0], - Title: tunaMetadata.Title, + Title: tunaMetadata.Title, + } + if len(tunaMetadata.Artists) > 0 { + req.Artist = tunaMetadata.Artists[0] } log.Printf("Trying to enrich metadata: %+v", req) resp, err := metacollectorClient.GetTrack(req)