summaryrefslogtreecommitdiff
path: root/src/audio
diff options
context:
space:
mode:
authorRobin Howard <robin@rhoward.id.au>2024-01-21 18:14:33 +1100
committerRobin Howard <buzzyrobin@noreply.codeberg.org>2024-01-23 02:30:18 +0000
commit429abd12377e2b79336e6364d6743bb3df50b3ac (patch)
tree4ce0e90cf604a696bf1274dabc0af0d0336d4494 /src/audio
parent3f1fadbeef571a6653f5648c2b78073ddd37d169 (diff)
downloadtangara-fw-429abd12377e2b79336e6364d6743bb3df50b3ac.tar.gz
Fix bug where calling TrackQueue's next() repeatedly would increase the position despite running off the end of the queue.
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/track_queue.cpp9
1 files 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_++;
}
}