Fixed panic when a song exceeded allowed duration
This commit is contained in:
parent
541f371239
commit
38be691913
|
@ -58,9 +58,9 @@ func NewPlaylist(user, id string) (*Playlist, error) {
|
|||
id: id,
|
||||
title: playlistTitle,
|
||||
}
|
||||
|
||||
j := 0
|
||||
for i := 0; i < playlistItems; i++ {
|
||||
index := strconv.Itoa(i)
|
||||
index := strconv.Itoa(j)
|
||||
songTitle, _ := jq.String("data", "items", index, "video", "title")
|
||||
songId, _ := jq.String("data", "items", index, "video", "id")
|
||||
songThumbnail, _ := jq.String("data", "items", index, "video", "thumbnail", "hqDefault")
|
||||
|
@ -78,6 +78,7 @@ func NewPlaylist(user, id string) (*Playlist, error) {
|
|||
// Don't spam the chat if a playlist contains songs that are too long
|
||||
if dj.conf.General.MaxSongDuration == 0 || duration <= dj.conf.General.MaxSongDuration {
|
||||
dj.queue.AddSong(newSong)
|
||||
j += 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue