]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMonitorJSONHandleTrayChange: Properly handle if 'devAlias' is missing
authorSergey Mironov <mironov@fintech.ru>
Wed, 11 Oct 2023 08:19:08 +0000 (11:19 +0300)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 11 Oct 2023 12:31:42 +0000 (14:31 +0200)
While qemu is still reporting the 'device' field in the tray even the
code was not ready for the possibility of it missing. Fix the condition
for clearing 'devAlias' if qemu doesn't report the 'device' field.

Signed-off-by: Sergey Mironov <mironov@fintech.ru>
src/qemu/qemu_monitor_json.c

index 8152eea9a0774c70731489b62ab529e49d3dbf8b..105d729d7cd4df2f3598c2bbe4863b0fbd360a51 100644 (file)
@@ -934,7 +934,7 @@ qemuMonitorJSONHandleTrayChange(qemuMonitor *mon,
     int reason;
 
     /* drive alias is always reported but empty for -blockdev */
-    if (*devAlias == '\0')
+    if (devAlias && *devAlias == '\0')
         devAlias = NULL;
 
     if (!devAlias && !devid) {