aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_edit.c
diff options
context:
space:
mode:
authorRomain Bignon <romain@peerfuse.org>2009-02-13 11:12:31 +0100
committerMax Kellermann <max@duempel.org>2009-02-13 11:12:31 +0100
commit855466df402bd9e8b3455c62bed08afa35eaf1e4 (patch)
treeeee120dece371e712210cb275a94b8d102ee832e /src/playlist_edit.c
parent9fe459f62581be39228dfbd69c1151df04fb6abe (diff)
downloadmpd-855466df402bd9e8b3455c62bed08afa35eaf1e4.tar.gz
mpd-855466df402bd9e8b3455c62bed08afa35eaf1e4.tar.xz
mpd-855466df402bd9e8b3455c62bed08afa35eaf1e4.zip
playlist_edit: improved range checks in shufflePlaylist()
Diffstat (limited to 'src/playlist_edit.c')
-rw-r--r--src/playlist_edit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/playlist_edit.c b/src/playlist_edit.c
index 2c0c62eb6..576cc8780 100644
--- a/src/playlist_edit.c
+++ b/src/playlist_edit.c
@@ -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);