1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-22 11:02:35 +01:00

Change shuffle() guard to check for size <= 2

After testing the app, I realized that shuffling a queue with size 2
does nothing
This commit is contained in:
Zhiheng Xu 2021-05-22 13:56:02 -04:00
parent 5ab6e84044
commit 2e161a1f45

View File

@ -432,11 +432,12 @@ public abstract class PlayQueue implements Serializable {
* Will emit a {@link ReorderEvent} if shuffled.
* </p>
*
* @implNote Does nothing if the queue is empty or has a size of 1
* @implNote Does nothing if the queue has a size <= 2 (the currently playing video must stay on
* top, so shuffling a size-2 list does nothing)
*/
public synchronized void shuffle() {
// Can't shuffle an list that's empty or only has one element
if (size() <= 1) {
if (size() <= 2) {
return;
}
// Create a backup if it doesn't already exist