json-parser: add handling for NULL token list
Currently a NULL token list will crash the parser, instead we have it pass back a NULL QObject. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
5e2dafeb19
commit
c1990ebfa1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user