Check for array before calling array_key_exists

This commit is contained in:
Jeremy Dormitzer 2019-03-14 22:40:16 -04:00
parent 6c724ff81d
commit 77d2821347

View File

@ -157,6 +157,9 @@ function get_object( $id ) {
'not_found', __( 'Object not found', 'pterotype' ), array( 'status' => 404 )
);
}
if ( is_array($object_json) && array_key_exists( 'object', $object_json ) ) {
$object_json = \pterotype\util\decompact_object( $object_json, array( 'object' ) );
}
return json_decode( $object_json, true );
}