Skip to content

Commit e883c38

Browse files
committed
#748: LrcLib fetcher - don't crash if song has no artist name tagged
1 parent a884795 commit e883c38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backend/lyricsmanager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ func (lm *LyricsManager) fetchLyrics(ctx context.Context, song *mediaprovider.Tr
6363
}
6464
}
6565
if lyrics == nil && lm.lrclib != nil {
66-
lyrics, err = lm.lrclib.FetchLrcLibLyrics(song.Title, song.ArtistNames[0], song.Album, int(song.Duration.Seconds()))
66+
artist := ""
67+
if len(song.ArtistNames) > 0 {
68+
artist = song.ArtistNames[0]
69+
}
70+
lyrics, err = lm.lrclib.FetchLrcLibLyrics(song.Title, artist, song.Album, int(song.Duration.Seconds()))
6771
if err != nil {
6872
log.Println(err.Error())
6973
}

0 commit comments

Comments
 (0)