mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
Don't check qobject_type() before qobject_to_qdict()
qobject_to_qdict(obj) returns NULL when obj isn't a QDict. Check that instead of qobject_type(obj) == QTYPE_QDICT. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1487363905-9480-8-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
4b32e11a59
commit
ca6b6e1e68
6 changed files with 21 additions and 44 deletions
|
@ -591,7 +591,6 @@ static void qdict_join_test(void)
|
|||
static void qdict_crumple_test_recursive(void)
|
||||
{
|
||||
QDict *src, *dst, *rule, *vnc, *acl, *listen;
|
||||
QObject *res;
|
||||
QList *rules;
|
||||
|
||||
src = qdict_new();
|
||||
|
@ -605,12 +604,8 @@ static void qdict_crumple_test_recursive(void)
|
|||
qdict_put(src, "vnc.acl..name", qstring_from_str("acl0"));
|
||||
qdict_put(src, "vnc.acl.rule..name", qstring_from_str("acl0"));
|
||||
|
||||
res = qdict_crumple(src, &error_abort);
|
||||
|
||||
g_assert_cmpint(qobject_type(res), ==, QTYPE_QDICT);
|
||||
|
||||
dst = qobject_to_qdict(res);
|
||||
|
||||
dst = qobject_to_qdict(qdict_crumple(src, &error_abort));
|
||||
g_assert(dst);
|
||||
g_assert_cmpint(qdict_size(dst), ==, 1);
|
||||
|
||||
vnc = qdict_get_qdict(dst, "vnc");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue