aboutsummaryrefslogtreecommitdiff
path: root/qapi/qobject-input-visitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'qapi/qobject-input-visitor.c')
-rw-r--r--qapi/qobject-input-visitor.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index 34065ba7dd..d192727e0b 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -122,10 +122,15 @@ static QObject *qobject_input_try_get_object(QObjectInputVisitor *qiv,
} else {
assert(qobject_type(qobj) == QTYPE_QLIST);
assert(!name);
- ret = qlist_entry_obj(tos->entry);
- assert(ret);
+ if (tos->entry) {
+ ret = qlist_entry_obj(tos->entry);
+ if (consume) {
+ tos->entry = qlist_next(tos->entry);
+ }
+ } else {
+ ret = NULL;
+ }
if (consume) {
- tos->entry = qlist_next(tos->entry);
tos->index++;
}
}