mirror of
https://github.com/rafagafe/tiny-json.git
synced 2025-03-12 19:25:30 +00:00
handle getProperty where obj is JSON_NULL
This commit is contained in:
parent
6fcbc470e6
commit
be4772ea70
@ -41,6 +41,9 @@ typedef struct jsonStaticPool_s {
|
||||
|
||||
/* Search a property by its name in a JSON object. */
|
||||
json_t const* json_getProperty( json_t const* obj, char const* property ) {
|
||||
if ( !obj || !property || json_getType( obj )==JSON_NULL ) {
|
||||
return 0;
|
||||
}
|
||||
if ( obj->name && !strcmp( obj->name, property ) ) {
|
||||
return obj;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user