Fixed reset on non-empty queue
Fixed an issue where reset didn't work when the queue had any tracks in it. The issue stemmed from the fact that in the last few lines of the PlayCurrent method in the queue.go, around line 314, it sets up another thread to wait and eventually skip the current track. When reset is called this skip is triggered on an empty queue which causes an error. Fixed it by adding a check around the offending lines.
This commit is contained in:
parent
a57c3f579d
commit
6e76c79e0a
|
@ -211,6 +211,7 @@ func (q *Queue) Skip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all playlist skips if this is the last track of the playlist still in the queue.
|
// Remove all playlist skips if this is the last track of the playlist still in the queue.
|
||||||
|
if len(q.Queue) > 0 {
|
||||||
if playlist := q.Queue[0].GetPlaylist(); playlist != nil {
|
if playlist := q.Queue[0].GetPlaylist(); playlist != nil {
|
||||||
id := playlist.GetID()
|
id := playlist.GetID()
|
||||||
playlistIsFinished := true
|
playlistIsFinished := true
|
||||||
|
@ -229,6 +230,7 @@ func (q *Queue) Skip() {
|
||||||
DJ.Skips.ResetPlaylistSkips()
|
DJ.Skips.ResetPlaylistSkips()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Skip the track.
|
// Skip the track.
|
||||||
length := len(q.Queue)
|
length := len(q.Queue)
|
||||||
|
|
Reference in a new issue