From 8eb09a2bb984f3550cc87074e57841b86be39601 Mon Sep 17 00:00:00 2001 From: Sergey Mironov Date: Wed, 11 Oct 2023 11:19:08 +0300 Subject: [PATCH] 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 --- src/qemu/qemu_monitor_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {