- SW: fixed crash with credits screen and CD tracks missing.

This commit is contained in:
Christoph Oelckers 2021-02-26 18:58:13 +01:00
parent 4c915180da
commit b15810e173

View file

@ -946,7 +946,7 @@ int PlayerYellVocs[] =
bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music. bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music.
{ {
// Play CD audio if enabled. // Play CD audio if enabled.
if (cdaudio_track >= 0 && (mus_redbook || *song_file_name == 0)) if (cdaudio_track >= 0 && (mus_redbook || !song_file_name || *song_file_name == 0))
{ {
FStringf trackname("track%02d.ogg", cdaudio_track); FStringf trackname("track%02d.ogg", cdaudio_track);
if (!Mus_Play(mapname, trackname, true)) if (!Mus_Play(mapname, trackname, true))
@ -955,6 +955,10 @@ bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track
} }
else return true; else return true;
} }
if (!song_file_name || *song_file_name == 0)
{
return true;
}
if (!Mus_Play(mapname, song_file_name, true)) if (!Mus_Play(mapname, song_file_name, true))
{ {
// try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing if mus_redbook is off.) // try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing if mus_redbook is off.)