Adjust json_object_is_type and json_object_get_type so they return json_type_null for NULL objects.
This commit is contained in:
1 parent
7e57d63aeb
commit
aef439a175
4 files changed
+65
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user