]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Skip volume change if sound device is not available (crash dump possible fix)
authorToni Wilen <twilen@winuae.net>
Mon, 4 Mar 2024 18:10:35 +0000 (20:10 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 4 Mar 2024 18:10:35 +0000 (20:10 +0200)
od-win32/sounddep/sound.cpp

index c1c79d6baa6218f05e4befbde27c53934566c37c..4f943a8bd95967d9d8f6a203a9a86e8980551f6d 100644 (file)
@@ -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;
 }