Skip to content
  • Dmitry Kolesnikov's avatar
    Fix shuffling of one track · 921aff71
    Dmitry Kolesnikov authored
    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.
    921aff71