diff options
author | Vladimir S Eremin <me@hidded.name> | 2009-02-09 13:29:00 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-09 21:14:38 +0100 |
commit | d9ce8d8342a2399c8e45cecb932b09d20b7254e1 (patch) | |
tree | 1fa1a0d702086dcac28e7a331cf21b883f7c04e4 /src/playlist.c | |
parent | e2f22229a63ae628b83fd237273f11c723dcd17c (diff) | |
download | mpd-d9ce8d8342a2399c8e45cecb932b09d20b7254e1.tar.gz mpd-d9ce8d8342a2399c8e45cecb932b09d20b7254e1.tar.xz mpd-d9ce8d8342a2399c8e45cecb932b09d20b7254e1.zip |
playlist: fixed "next song" check
Check if the "current+1" position is actually valid.
Diffstat (limited to 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/playlist.c b/src/playlist.c index ed430bf6e..4bdc0b4a8 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -338,12 +338,11 @@ int getPlaylistNextSong(const struct playlist *playlist) { if (playlist->current >= 0) { - if (queue_length(&playlist->queue) > 1) + if (playlist->current + 1 < (int)queue_length(&playlist->queue)) return queue_order_to_position(&playlist->queue, playlist->current + 1); else if (playlist->queue.repeat == 1) - return queue_order_to_position(&playlist->queue, - playlist->current); + return queue_order_to_position(&playlist->queue, 0); } return -1; |