- fixed crash when exiting before sound engine initialization

https://forum.zdoom.org/viewtopic.php?t=66605
This commit is contained in:
alexey.lysiuk 2019-12-09 15:43:01 +02:00
parent 47305a740f
commit 430a6f3247
1 changed files with 8 additions and 5 deletions

View File

@ -741,10 +741,14 @@ void FPlayerSoundHashTable::MarkUsed()
void S_ClearSoundData()
{
soundEngine->StopAllChannels();
soundEngine->UnloadAllSounds();
auto &S_sfx = soundEngine->GetSounds();
S_sfx.Clear();
if (soundEngine)
{
soundEngine->StopAllChannels();
soundEngine->UnloadAllSounds();
soundEngine->GetSounds().Clear();
soundEngine->ClearRandoms();
}
Ambients.Clear();
while (MusicVolumes != NULL)
{
@ -752,7 +756,6 @@ void S_ClearSoundData()
MusicVolumes = me->Next;
M_Free(me);
}
soundEngine->ClearRandoms();
NumPlayerReserves = 0;
PlayerClassesIsSorted = false;