]> git.proxmox.com Git - mirror_qemu.git/commitdiff
audio: add sanity check
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 15 Dec 2020 08:11:51 +0000 (09:11 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 15 Dec 2020 08:28:52 +0000 (09:28 +0100)
Check whenever we actually found the spiceaudio driver
before flipping the can_be_default field.

Fixes: f0c4555edfdd ("audio: remove qemu_spice_audio_init()")
Buglink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977301
Reported-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20201215081151.20095-1-kraxel@redhat.com>

audio/audio.c

index 0fdb808d6a578ae4bb01f480820a9d8d916a3510..b48471bb3f64f5083dfb3fc298437ab7cd9ef6ec 100644 (file)
@@ -1684,7 +1684,9 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
          * backend and this can go away.
          */
         driver = audio_driver_lookup("spice");
-        driver->can_be_default = 1;
+        if (driver) {
+            driver->can_be_default = 1;
+        }
     }
 
     if (dev) {