Commit 121e2063 authored by Warren Dukes's avatar Warren Dukes

fix for floating point exception when adding randomly to the playlist with

only one thing in the playlist or playing the last song in the playlist git-svn-id: https://svn.musicpd.org/mpd/trunk@1162 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 90c75b11
...@@ -505,10 +505,12 @@ int addSongToPlaylist(FILE * fp, Song * song) { ...@@ -505,10 +505,12 @@ int addSongToPlaylist(FILE * fp, Song * song) {
/*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;
if(start < playlist.length) {
swap = rand()%(playlist.length-start); swap = rand()%(playlist.length-start);
swap+=start; swap+=start;
swapOrder(playlist.length-1,swap); swapOrder(playlist.length-1,swap);
} }
}
incrPlaylistVersion(); incrPlaylistVersion();
......
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