aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-21 17:11:41 +0100
committerMax Kellermann <max@duempel.org>2009-01-21 17:11:41 +0100
commit8484c3708bc1a75af8064c3cc87933a39866d3d9 (patch)
tree633b219b83441f6345d140b130374f7c9fabe556
parent1d02318d21bcc7c2dc93b6e509c759a35bc0486e (diff)
downloadmpd-8484c3708bc1a75af8064c3cc87933a39866d3d9.tar.gz
mpd-8484c3708bc1a75af8064c3cc87933a39866d3d9.tar.xz
mpd-8484c3708bc1a75af8064c3cc87933a39866d3d9.zip
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.
-rw-r--r--src/playlist.c5
1 files changed, 3 insertions, 2 deletions
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;