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 <mironov@fintech.ru>
This commit is contained in:
Sergey Mironov 2023-10-11 11:19:08 +03:00 committed by Peter Krempa
parent 25685ebe7c
commit 8eb09a2bb9

View 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) {