Skip to content

Fix shuffling of one track

Dmitry Kolesnikov requested to merge (removed):fixMixingOfOneTrack into master

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.

I made this mistake in the commit 9af53fb9. I do not know how I forgot to check the case when there is only one item in the playlist. I'm ashamed of what happened.

Merge request reports

Loading