Skip to content

Commit

Permalink
Add isset check
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Oct 20, 2022
1 parent 1b6afb8 commit 7c1c7f7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function prepare_item_for_response( $item, $request ) {
$field = $block_type->$extra_field;
if ( in_array( $extra_field, $deprecated_fields, true ) && is_array( $field ) ) {
// Since the schema only allows strings or null (but no arrays), we return the first array item.
$field = $field[0];
$field = isset( $field[0] ) ? $field[0] : null;
}
} elseif ( array_key_exists( 'default', $schema['properties'][ $extra_field ] ) ) {
$field = $schema['properties'][ $extra_field ]['default'];
Expand Down

0 comments on commit 7c1c7f7

Please sign in to comment.