Skip to content

Commit 931893b

Browse files
Merge pull request #1071 from cloudinary/fix/innerBlocks-warning
Optimize innerBlocks loop
2 parents 43e3bde + c558f49 commit 931893b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

php/media/class-video.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,12 @@ public function has_video_block( $source_block ) {
242242
if ( 'core/video' === $source_block['blockName'] ) {
243243
return true;
244244
}
245-
foreach ( $source_block['innerBlocks'] as $block ) {
246-
if ( $this->has_video_block( $block ) ) {
247-
return true;
245+
246+
if ( ! empty( $source_block['innerBlocks'] ) ) {
247+
foreach ( $source_block['innerBlocks'] as $block ) {
248+
if ( $this->has_video_block( $block ) ) {
249+
return true;
250+
}
248251
}
249252
}
250253

0 commit comments

Comments
 (0)