Browse Source

Fix json_object_object_get() so it returns NULL if the incoming json_object is NULL.

tags/json-c-0.11-20130402
Eric Haszlakiewicz 13 years ago
parent
commit
5450bed051
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      json_object.c

+ 4
- 1
json_object.c View File

@@ -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) {


Loading…
Cancel
Save