aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi-visit.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi-visit.py')
-rw-r--r--scripts/qapi-visit.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 4f97781348..d7f51ee250 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -301,7 +301,9 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
out_obj:
error_propagate(errp, err);
err = NULL;
- visit_end_union(v, !!(*obj)->data, &err);
+ if (*obj) {
+ visit_end_union(v, !!(*obj)->data, &err);
+ }
error_propagate(errp, err);
err = NULL;
visit_end_struct(v, &err);