From 37963a72b9d84aee437bed2913fe85bfb1624600 Mon Sep 17 00:00:00 2001 From: Dave Gamble Date: Thu, 26 Nov 2009 20:17:25 +0000 Subject: [PATCH] Don't crash if someone calls cJSON_Print(0); git-svn-id: http://svn.code.sf.net/p/cjson/code@24 e3330c51-1366-4df0-8b21-3ccf24e3d50e --- cJSON.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cJSON.c b/cJSON.c index 56cc85b..62d7bf2 100644 --- a/cJSON.c +++ b/cJSON.c @@ -256,6 +256,7 @@ static const char *parse_value(cJSON *item,const char *value) // Render a value to text. static char *print_value(cJSON *item,int depth,int fmt) { + if (!item) return 0; char *out=0; switch ((item->type)&255) {