Signed-off-by: Paolo Bonzini<address@hidden>
---
qapi/qmp-output-visitor.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index f76d015..29575da 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -65,13 +65,13 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
static QObject *qmp_output_first(QmpOutputVisitor *qov)
{
QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
- return e->value;
+ return e ? e->value : NULL;
}
static QObject *qmp_output_last(QmpOutputVisitor *qov)
{
QStackEntry *e = QTAILQ_FIRST(&qov->stack);
- return e->value;
+ return e ? e->value : NULL;
}
static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,