playlist_edit: improved range checks in shufflePlaylist()

This commit is contained in:
Romain Bignon 2009-02-13 11:12:31 +01:00 committed by Max Kellermann
parent 9fe459f625
commit 855466df40
1 changed files with 6 additions and 1 deletions

View File

@ -357,7 +357,12 @@ void shufflePlaylist(struct playlist *playlist, unsigned start, unsigned end)
{
const struct song *queued;
if (end-1 <= start || end > queue_length(&playlist->queue))
if (end > queue_length(&playlist->queue))
/* correct the "end" offset */
end = queue_length(&playlist->queue);
if ((start+1) >= end)
/* needs at least two entries. */
return;
queued = playlist_get_queued_song(playlist);