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
This commit is contained in:
Warren Dukes 2004-02-25 22:00:21 +00:00
parent 8edc416344
commit 9d4bc4efea
1 changed files with 2 additions and 2 deletions

View File

@ -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;