Commit 9d4bc4ef authored by Warren Dukes's avatar Warren Dukes

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
parent 8edc4163
...@@ -395,7 +395,7 @@ void queueNextSongInPlaylist() { ...@@ -395,7 +395,7 @@ void queueNextSongInPlaylist() {
} }
else if(playlist.length && playlist.repeat) { else if(playlist.length && playlist.repeat) {
if(playlist.length>1 && playlist.random) { if(playlist.length>1 && playlist.random) {
randomizeOrder(0,playlist.length); randomizeOrder(0,playlist.length-1);
} }
playlist.queued = 0; playlist.queued = 0;
DEBUG("playlist: queue song %i:\"%s\"\n", DEBUG("playlist: queue song %i:\"%s\"\n",
...@@ -490,7 +490,7 @@ int addSongToPlaylist(FILE * fp, Song * song) { ...@@ -490,7 +490,7 @@ int addSongToPlaylist(FILE * fp, Song * song) {
int swap; int swap;
int start; int start;
if(playlist_state==PLAYLIST_STATE_STOP) start = 0; 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; else start = playlist.current+1;
swap = rand()%(playlist.length-start); swap = rand()%(playlist.length-start);
swap+=start; swap+=start;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment