aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);