]> git.proxmox.com Git - qemu.git/commitdiff
qdev: don't crash on unset drive properties.
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 22 Sep 2009 11:53:20 +0000 (13:53 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 5 Oct 2009 14:32:50 +0000 (09:32 -0500)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/qdev-properties.c

index c4fb15c02046eacc3ce3692499e2cec46c8aa29d..5c627fae40819ce19c49b31adff3a51bdd39ebca 100644 (file)
@@ -208,7 +208,7 @@ static int parse_drive(DeviceState *dev, Property *prop, const char *str)
 static int print_drive(DeviceState *dev, Property *prop, char *dest, size_t len)
 {
     DriveInfo **ptr = qdev_get_prop_ptr(dev, prop);
-    return snprintf(dest, len, "%s", (*ptr)->id);
+    return snprintf(dest, len, "%s", (*ptr) ? (*ptr)->id : "<null>");
 }
 
 PropertyInfo qdev_prop_drive = {