From: Sergey Mironov Date: Wed, 11 Oct 2023 08:19:08 +0000 (+0300) Subject: qemuMonitorJSONHandleTrayChange: Properly handle if 'devAlias' is missing X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8eb09a2bb984f3550cc87074e57841b86be39601;p=libvirt.git qemuMonitorJSONHandleTrayChange: Properly handle if 'devAlias' is missing 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 --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8152eea9a0..105d729d7c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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) {