提交 41b5e892 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

qdev: don't crash on unset drive properties.

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 99244fa1
......@@ -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 = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册