More guards

This commit is contained in:
Clownacy 2020-04-18 01:23:25 +01:00
parent 873566a19e
commit 011cb94f73

View file

@ -112,7 +112,9 @@ static int ThreadFunction(int argc, const char *argv[])
{ {
if (!AXIsVoiceRunning(sound->voice)) if (!AXIsVoiceRunning(sound->voice))
{ {
AXVoiceBegin(sound->voice);
AXFreeVoice(sound->voice); AXFreeVoice(sound->voice);
AXVoiceEnd(sound->voice);
sound->voice = NULL; sound->voice = NULL;
} }
} }
@ -210,7 +212,11 @@ void AudioBackend_DestroySound(AudioBackend_Sound *sound)
OSUnlockMutex(&sound_list_mutex); OSUnlockMutex(&sound_list_mutex);
if (sound->voice != NULL) if (sound->voice != NULL)
{
AXVoiceBegin(sound->voice);
AXFreeVoice(sound->voice); AXFreeVoice(sound->voice);
AXVoiceEnd(sound->voice);
}
free(sound->samples); free(sound->samples);
free(sound); free(sound);