Skip to content
Commit 921aff71 authored by Dmitry Kolesnikov's avatar Dmitry Kolesnikov
Browse files

Fix shuffling of one track

There was an error in the code responsible for making the current
element the first. If the shuffle button is pressed when there is
only one track in the queue, Elisa breaks.

The for loop changes the values to playListSize - 1, and the last
element is added separately. But at the same time, this element has
already been processed before, which leads to a discrepancy.

Another point is that if there is only one element in the queue, then
std::swap(x, x) occurs here, which can be regarded as undefined
behavior. The same happens if the current track is already the first.

Now these cases are processed.
parent c1e93a8b
Pipeline #230887 passed with stage
in 5 minutes and 11 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment