From 5a010136427346ac9acaf7bb496ece3de39f5790 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Sat, 8 Feb 2014 09:41:49 -0800 Subject: [PATCH] Make sure the root pointer is null for errors at the top level --- jsonpull.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsonpull.c b/jsonpull.c index 09baf8ce..f03c0174 100644 --- a/jsonpull.c +++ b/jsonpull.c @@ -182,6 +182,12 @@ static void string_free(struct string *s) { json_object *json_read_separators(json_pull *j, json_separator_callback cb, void *state) { int c; + + // In case there is an error at the top level + if (j->container == NULL) { + j->root = NULL; + } + again: /////////////////////////// Whitespace