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.
This commit is contained in:
Max Kellermann 2009-01-21 17:11:41 +01:00
parent 1d02318d21
commit 8484c3708b
1 changed files with 3 additions and 2 deletions

View File

@ -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;