From: Eric Haszlakiewicz Date: Thu, 18 Oct 2012 22:14:41 +0000 (-0500) Subject: Fix json_object_object_get() so it returns NULL if the incoming json_object is NULL. X-Git-Tag: json-c-0.11-20130402~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5450bed05147c5d80e3c8c7f79d893d4a22dae4e;p=thirdparty%2Fjson-c.git Fix json_object_object_get() so it returns NULL if the incoming json_object is NULL. --- diff --git a/json_object.c b/json_object.c index bb344af0..4c179ab0 100644 --- a/json_object.c +++ b/json_object.c @@ -390,13 +390,16 @@ void json_object_object_add(struct json_object* jso, const char *key, struct json_object* json_object_object_get(struct json_object* jso, const char *key) { - struct json_object *result; + struct json_object *result = NULL; json_object_object_get_ex(jso, key, &result); return result; } json_bool json_object_object_get_ex(struct json_object* jso, const char *key, struct json_object **value) { + if (value != NULL) + *value = NULL; + if (NULL == jso) return FALSE; switch(jso->o_type) {