From: Toni Wilen Date: Mon, 4 Mar 2024 18:10:35 +0000 (+0200) Subject: Skip volume change if sound device is not available (crash dump possible fix) X-Git-Tag: 5300~98 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=4ba3a949c52a6ab26ab0751fcdd4753ee4b9d8b2;p=francis%2Fwinuae.git Skip volume change if sound device is not available (crash dump possible fix) --- diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index c1c79d6b..4f943a8b 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -521,6 +521,9 @@ void set_volume_sound_device (struct sound_data *sd, int volume, int mute) { struct sound_dp *s = sd->data; HRESULT hr; + if (!s) { + return; + } if (sd->devicetype == SOUND_DEVICE_AL) { float vol = 0.0f; if (volume < 100.0f && !mute) @@ -570,10 +573,10 @@ void set_volume_sound_device (struct sound_data *sd, int volume, int mute) } -void set_volume (int volume, int mute) +void set_volume(int volume, int mute) { - set_volume_sound_device (sdp, volume, mute); - setvolume_ahi (volume); + set_volume_sound_device(sdp, volume, mute); + setvolume_ahi(volume); config_changed = 1; }