From dac29bf98632bb4450932b06e12328af48f1bb9e Mon Sep 17 00:00:00 2001 From: ailurux Date: Mon, 30 Dec 2024 11:04:03 +1100 Subject: [PATCH] Fix issue with playlists restarting playback after enqueuing --- src/tangara/audio/track_queue.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tangara/audio/track_queue.cpp b/src/tangara/audio/track_queue.cpp index 5689ecf0..0db507f7 100644 --- a/src/tangara/audio/track_queue.cpp +++ b/src/tangara/audio/track_queue.cpp @@ -46,6 +46,9 @@ RandomIterator::RandomIterator(size_t size) } auto RandomIterator::current() const -> size_t { + if (size_ == 0) { + return 0; + } return MillerShuffle(pos_, seed_, size_); } @@ -191,7 +194,7 @@ auto TrackQueue::append(Item i) -> void { bool current_changed; { const std::shared_lock lock(mutex_); - was_queue_empty = playlist_.currentPosition() >= playlist_.size(); + was_queue_empty = currentPosition() >= totalSize(); current_changed = was_queue_empty; // Dont support inserts yet }