From 9d4bc4efea0359896863b67e5e5223d8025099f8 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Wed, 25 Feb 2004 22:00:21 +0000 Subject: [PATCH] finally found the segfault, it occurs with random and repeat on, in queueNextSong() was doing randomizeOrder(0,playlist.length) instead of playlist.length-1 git-svn-id: https://svn.musicpd.org/mpd/trunk@61 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/playlist.c b/src/playlist.c index e9b0c3228..4c2adc5d9 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -395,7 +395,7 @@ void queueNextSongInPlaylist() { } else if(playlist.length && playlist.repeat) { if(playlist.length>1 && playlist.random) { - randomizeOrder(0,playlist.length); + randomizeOrder(0,playlist.length-1); } playlist.queued = 0; DEBUG("playlist: queue song %i:\"%s\"\n", @@ -490,7 +490,7 @@ int addSongToPlaylist(FILE * fp, Song * song) { int swap; int start; if(playlist_state==PLAYLIST_STATE_STOP) start = 0; - else if(playlist.queued>0) start = playlist.queued+1; + else if(playlist.queued>=0) start = playlist.queued+1; else start = playlist.current+1; swap = rand()%(playlist.length-start); swap+=start;