playlist: fixed "next song" check
Check if the "current+1" position is actually valid.
This commit is contained in:
parent
e2f22229a6
commit
d9ce8d8342
@ -338,12 +338,11 @@ int getPlaylistNextSong(const struct playlist *playlist)
|
|||||||
{
|
{
|
||||||
if (playlist->current >= 0)
|
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,
|
return queue_order_to_position(&playlist->queue,
|
||||||
playlist->current + 1);
|
playlist->current + 1);
|
||||||
else if (playlist->queue.repeat == 1)
|
else if (playlist->queue.repeat == 1)
|
||||||
return queue_order_to_position(&playlist->queue,
|
return queue_order_to_position(&playlist->queue, 0);
|
||||||
playlist->current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user