summaryrefslogtreecommitdiff
path: root/qapi/qmp-output-visitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'qapi/qmp-output-visitor.c')
-rw-r--r--qapi/qmp-output-visitor.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index 74a5684ed3..96b338463e 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -66,6 +66,12 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
static QObject *qmp_output_first(QmpOutputVisitor *qov)
{
QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
+
+ /* FIXME - find a better way to deal with NULL values */
+ if (!e) {
+ return NULL;
+ }
+
return e->value;
}