Fix json_object_size() return value
Return 0 as documented if the argument is not a JSON object. Closes GH-18.
This commit is contained in:
parent
b90ed1accb
commit
6ecba84817
@ -91,7 +91,7 @@ size_t json_object_size(const json_t *json)
|
|||||||
json_object_t *object;
|
json_object_t *object;
|
||||||
|
|
||||||
if(!json_is_object(json))
|
if(!json_is_object(json))
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
object = json_to_object(json);
|
object = json_to_object(json);
|
||||||
return object->hashtable.size;
|
return object->hashtable.size;
|
||||||
|
Loading…
Reference in New Issue
Block a user