From 429abd12377e2b79336e6364d6743bb3df50b3ac Mon Sep 17 00:00:00 2001 From: Robin Howard Date: Sun, 21 Jan 2024 18:14:33 +1100 Subject: [PATCH] Fix bug where calling TrackQueue's next() repeatedly would increase the position despite running off the end of the queue. --- src/audio/track_queue.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/audio/track_queue.cpp b/src/audio/track_queue.cpp index 7e08e3a2..6bab60e7 100644 --- a/src/audio/track_queue.cpp +++ b/src/audio/track_queue.cpp @@ -200,9 +200,12 @@ auto TrackQueue::next() -> void { shuffle_->next(); pos_ = shuffle_->current(); } else { - pos_++; - if (pos_ >= tracks_.size() && repeat_) { - pos_ = 0; + if (pos_ + 1 >= tracks_.size()) { + if (repeat_) { + pos_ = 0; + } + } else { + pos_++; } }