Adjust json_object_is_type and json_object_get_type so they return json_type_null for NULL objects.

This commit is contained in:
Eric Haszlakiewicz
2012-03-31 13:47:28 -05:00
parent 7e57d63aeb
commit aef439a175
4 changed files with 65 additions and 0 deletions

View File

@@ -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;
}