diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2012-10-18 17:14:41 -0500 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2012-10-18 17:14:41 -0500 |
commit | 5450bed05147c5d80e3c8c7f79d893d4a22dae4e (patch) | |
tree | 66d6e5999d6ad66104972a68381ca1ba083e8d4c /json_object.c | |
parent | 5f4739e2eb6407a6fae898802d165daab1ad7986 (diff) | |
download | json-c-5450bed05147c5d80e3c8c7f79d893d4a22dae4e.tar.gz |
Fix json_object_object_get() so it returns NULL if the incoming json_object is NULL.
Diffstat (limited to 'json_object.c')
-rw-r--r-- | json_object.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/json_object.c b/json_object.c index bb344af..4c179ab 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) { |