Skip to content

Commit 2e161a1

Browse files
committed
Change shuffle() guard to check for size <= 2
After testing the app, I realized that shuffling a queue with size 2 does nothing
1 parent 5ab6e84 commit 2e161a1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,12 @@ public synchronized void unsetRecovery(final int index) {
432432
* Will emit a {@link ReorderEvent} if shuffled.
433433
* </p>
434434
*
435-
* @implNote Does nothing if the queue is empty or has a size of 1
435+
* @implNote Does nothing if the queue has a size <= 2 (the currently playing video must stay on
436+
* top, so shuffling a size-2 list does nothing)
436437
*/
437438
public synchronized void shuffle() {
438439
// Can't shuffle an list that's empty or only has one element
439-
if (size() <= 1) {
440+
if (size() <= 2) {
440441
return;
441442
}
442443
// Create a backup if it doesn't already exist

0 commit comments

Comments
 (0)