aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qga.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-qga.c')
-rw-r--r--tests/test-qga.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c
index 0531c9f3bc..64738465c5 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -273,13 +273,15 @@ static void test_qga_get_fsinfo(gconstpointer fix)
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
- /* check there is at least a fs */
+ /* sanity-check the response if there are any filesystems */
list = qdict_get_qlist(ret, "return");
entry = qlist_first(list);
- g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name"));
- g_assert(qdict_haskey(qobject_to_qdict(entry->value), "mountpoint"));
- g_assert(qdict_haskey(qobject_to_qdict(entry->value), "type"));
- g_assert(qdict_haskey(qobject_to_qdict(entry->value), "disk"));
+ if (entry) {
+ g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name"));
+ g_assert(qdict_haskey(qobject_to_qdict(entry->value), "mountpoint"));
+ g_assert(qdict_haskey(qobject_to_qdict(entry->value), "type"));
+ g_assert(qdict_haskey(qobject_to_qdict(entry->value), "disk"));
+ }
QDECREF(ret);
}