summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 80685f8655..b349799269 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1828,7 +1828,8 @@ static int get_next_index(const struct playlist_info* playlist, int steps,
}
/* No luck if the whole playlist was bad. */
- if (playlist->indices[next_index] & PLAYLIST_SKIPPED)
+ if (next_index < 0 || next_index >= playlist->amount ||
+ playlist->indices[next_index] & PLAYLIST_SKIPPED)
return -1;
return next_index;