aboutsummaryrefslogtreecommitdiff
path: root/json-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'json-parser.c')
-rw-r--r--json-parser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/json-parser.c b/json-parser.c
index 58e973bc18..849e2156da 100644
--- a/json-parser.c
+++ b/json-parser.c
@@ -633,9 +633,13 @@ QObject *json_parser_parse(QList *tokens, va_list *ap)
QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp)
{
JSONParserContext ctxt = {};
- QList *working = qlist_copy(tokens);
+ QList *working;
QObject *result;
+ if (!tokens) {
+ return NULL;
+ }
+ working = qlist_copy(tokens);
result = parse_value(&ctxt, &working, ap);
QDECREF(working);