diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-02-25 22:00:21 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-02-25 22:00:21 +0000 |
commit | 9d4bc4efea0359896863b67e5e5223d8025099f8 (patch) | |
tree | 3e8572cc7dc33691c684347f155da3b82f3e2781 /src | |
parent | 8edc416344afe51e3509d09e11a37c91517e0f6a (diff) | |
download | mpd-9d4bc4efea0359896863b67e5e5223d8025099f8.tar.gz mpd-9d4bc4efea0359896863b67e5e5223d8025099f8.tar.xz mpd-9d4bc4efea0359896863b67e5e5223d8025099f8.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/playlist.c | 4 |
1 files 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; |