From 4ba3a949c52a6ab26ab0751fcdd4753ee4b9d8b2 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 4 Mar 2024 20:10:35 +0200 Subject: [PATCH] Skip volume change if sound device is not available (crash dump possible fix) --- od-win32/sounddep/sound.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.47.3