From bda610d99ce5e4289f64902ce2bf6a23d7c5082a Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 16 Jan 2023 20:02:07 +0100 Subject: [PATCH] Fix duplicated videos in the playing queue --- .../java/com/github/libretube/util/PlayingQueue.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt index 35f3c3436..31769d384 100644 --- a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt +++ b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt @@ -30,11 +30,11 @@ object PlayingQueue { fun clear() = queue.clear() fun add(vararg streamItem: StreamItem) { - streamItem.forEach { - if (currentStream != it) { - if (queue.contains(it)) queue.remove(it) - queue.add(it) - } + for (stream in streamItem) { + if (currentStream?.url?.toID() == stream.url?.toID()) continue + // remove if already present + queue.remove(stream) + queue.add(stream) } }