From 8484c3708bc1a75af8064c3cc87933a39866d3d9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 21 Jan 2009 17:11:41 +0100 Subject: playlist: convert assertion to check in TAG event handler It is possible that playlist.current is reset before the TAG event handler playlist_tag_event() is called. Convert the assertion into a run-time check. --- src/playlist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/playlist.c b/src/playlist.c index 5d17f8cb9..4580ccbcc 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -123,10 +123,11 @@ playlist_tag_event(void) { unsigned song; - if (playlist_state != PLAYLIST_STATE_PLAY) + if (playlist_state != PLAYLIST_STATE_PLAY || + playlist.current < 0) return; - assert(playlist.current >= 0); + assert((unsigned)playlist.current < playlist.length); song = playlist.order[playlist.current]; playlist.songMod[song] = playlist.version; -- cgit v1.2.3