The devAlias check is performed in the "if (!devAlias && !devid) {", so the 
situation is not handled when devAlias is NULL, and devid is not NULL

Signed-off-by: Sergey Mironov <miro...@fintech.ru>
---
 src/qemu/qemu_monitor_json.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5b9edadcf7..80b41d77d3 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -933,6 +933,11 @@ qemuMonitorJSONHandleTrayChange(qemuMonitor *mon,
     bool trayOpened;
     int reason;
 
+    if (!devAlias) {
+        VIR_WARN("missing device in tray change event");
+        return;
+    }
+
     /* drive alias is always reported but empty for -blockdev */
     if (*devAlias == '\0')
         devAlias = NULL;
-- 
2.31.1

Reply via email to