audio: conditionally shutdown SFX/Music players

Fixes a potential segfault during startup where the sound hasn't been
initialized yet, but an I_Error occurs while loading data.
This commit is contained in:
Eidolon 2023-01-09 14:58:59 -06:00
parent c5ecec1523
commit 9f649d7701

View file

@ -186,6 +186,7 @@ void I_ShutdownSound(void) {
SdlAudioLockHandle _;
for (auto& channel : sound_effect_channels) {
if (channel)
*channel = audio::SoundEffectPlayer();
}
}
@ -329,6 +330,7 @@ void I_InitMusic(void) {
void I_ShutdownMusic(void) {
SdlAudioLockHandle _;
if (music_player)
*music_player = audio::MusicPlayer();
}