diff --git a/cJSON.c b/cJSON.c index fe446d61d6fb9a57c08fd1bc71ebcd3a4881dfb4..b1f3cc190777710ea57be385cc7f023ddd8f2ffa 100644 --- a/cJSON.c +++ b/cJSON.c @@ -467,7 +467,7 @@ static char *print_object(cJSON *item,int depth,int fmt) /* Collect all the results into our arrays: */ child=item->child;depth++;if (fmt) len+=depth; - while (child) + while (child&&!fail) { names[i]=str=print_string_ptr(child->string); entries[i++]=ret=print_value(child,depth,fmt);