QAPI currently cannot deal with no object pushed to the stack, and dereferences a NULL pointer. This is visible with
qom-get path=/i440fx/piix3 property=romfile after static non-string properties are introduced. Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- 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, -- 1.7.7.1