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
This commit is contained in:
parent
90c75b1107
commit
121e2063e0
@ -505,9 +505,11 @@ 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;
|
||||||
swap = rand()%(playlist.length-start);
|
if(start < playlist.length) {
|
||||||
swap+=start;
|
swap = rand()%(playlist.length-start);
|
||||||
swapOrder(playlist.length-1,swap);
|
swap+=start;
|
||||||
|
swapOrder(playlist.length-1,swap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
incrPlaylistVersion();
|
incrPlaylistVersion();
|
||||||
|
Loading…
Reference in New Issue
Block a user