playlist/cue/parser: fix nullptr dereference

Closes https://github.com/MusicPlayerDaemon/MPD/issues/974
This commit is contained in:
Max Kellermann 2020-10-05 20:18:04 +02:00
parent ac46a84391
commit cb4fdac469
2 changed files with 4 additions and 2 deletions

2
NEWS
View File

@ -3,7 +3,7 @@ ver 0.22.1 (not yet released)
- alsa: don't deadlock when the ALSA driver is buggy
- jack, pulse: reduce the delay when stopping or pausing playback
* playlist
- cue: fix crash bug
- cue: fix two crash bugs
ver 0.22 (2020/09/23)
* protocol

View File

@ -262,7 +262,9 @@ CueParser::Feed2(char *p) noexcept
if (previous != nullptr && previous->GetStartTime().ToMS() < (unsigned)position_ms)
previous->SetEndTime(SongTime::FromMS(position_ms));
current->SetStartTime(SongTime::FromMS(position_ms));
if (current != nullptr)
current->SetStartTime(SongTime::FromMS(position_ms));
if(strcmp(nr, "00") != 0 || previous == nullptr)
ignore_index = true;
}