handle getProperty where obj is JSON_NULL

This commit is contained in:
Jeff Mathews 2022-07-08 16:33:12 -06:00 committed by GitHub
parent 6fcbc470e6
commit be4772ea70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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