From d9ce8d8342a2399c8e45cecb932b09d20b7254e1 Mon Sep 17 00:00:00 2001 From: Vladimir S Eremin Date: Mon, 9 Feb 2009 13:29:00 +0100 Subject: playlist: fixed "next song" check Check if the "current+1" position is actually valid. --- src/playlist.c | 5 ++--- 1 file 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; -- cgit v1.2.3