Skip to content

Commit

Permalink
- fixed crash when exiting before sound engine initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Dec 9, 2019
1 parent 47305a7 commit 430a6f3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sound/s_advsound.cpp
Expand Up @@ -741,18 +741,21 @@ 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)
{
FMusicVolume *me = MusicVolumes;
MusicVolumes = me->Next;
M_Free(me);
}
soundEngine->ClearRandoms();

NumPlayerReserves = 0;
PlayerClassesIsSorted = false;
Expand Down

0 comments on commit 430a6f3

Please sign in to comment.