Skip to contentSkip to conversation

audio: add sanity check

PATCH New Gerd Hoffmann 1 participant 1 message Dec 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio: add sanity check

Check whenever we actually found the spiceaudio driver before flipping the can_be_default field.

Fixes f0c4555edfdd ("audio: remove qemu_spice_audio_init()")
---
 audio/audio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
audio/audio.c +3 -1
index 46578e4a583b..973804620d7b 100644
@@ -1709,7 +1709,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) {
Signature · 1 line
2.27.0