diff options
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/qom/object.c b/qom/object.c index f2ae6e6b2a..5cd43fe366 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1415,15 +1415,18 @@ char *object_property_get_str(Object *obj, const char *name, Error **errp) { QObject *ret = object_property_get_qobject(obj, name, errp); + QString *qstring; char *retval; if (!ret) { return NULL; } - - retval = g_strdup(qobject_get_try_str(ret)); - if (!retval) { + qstring = qobject_to(QString, ret); + if (!qstring) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string"); + retval = NULL; + } else { + retval = g_strdup(qstring_get_str(qstring)); } qobject_unref(ret); |