diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2012-03-31 13:47:28 -0500 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2012-03-31 13:47:28 -0500 |
commit | aef439a1750a69c4721df50b83d696218a60db49 (patch) | |
tree | 3135536fb97c5af86df48c7324df009110224b5a /json_object.c | |
parent | 7e57d63aebf68889d3fe5ff94ab33e49f8de5ea3 (diff) | |
download | json-c-aef439a1750a69c4721df50b83d696218a60db49.tar.gz |
Adjust json_object_is_type and json_object_get_type so they return json_type_null for NULL objects.
Diffstat (limited to 'json_object.c')
-rw-r--r-- | json_object.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/json_object.c b/json_object.c index 7848630..ef54ecd 100644 --- a/json_object.c +++ b/json_object.c @@ -166,11 +166,15 @@ static struct json_object* json_object_new(enum json_type o_type) int json_object_is_type(struct json_object *jso, enum json_type type) { + if (!jso) + return (type == json_type_null); return (jso->o_type == type); } enum json_type json_object_get_type(struct json_object *jso) { + if (!jso) + return json_type_null; return jso->o_type; } |