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:
parent
5ab6e84044
commit
2e161a1f45
1 changed files with 3 additions and 2 deletions
|
@ -432,11 +432,12 @@ public abstract class PlayQueue implements Serializable {
|
||||||
* Will emit a {@link ReorderEvent} if shuffled.
|
* Will emit a {@link ReorderEvent} if shuffled.
|
||||||
* </p>
|
* </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() {
|
public synchronized void shuffle() {
|
||||||
// Can't shuffle an list that's empty or only has one element
|
// Can't shuffle an list that's empty or only has one element
|
||||||
if (size() <= 1) {
|
if (size() <= 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Create a backup if it doesn't already exist
|
// Create a backup if it doesn't already exist
|
||||||
|
|
Loading…
Add table
Reference in a new issue