Skip to content

Commit

Permalink
Cover against non existing styles (#33127)
Browse files Browse the repository at this point in the history
  • Loading branch information
nosolosw authored Jul 1, 2021
1 parent b543d8a commit f9eb406
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ function_exists( 'gutenberg_is_edit_site_page' ) &&
'__experimentalNoWrapper' => true,
);

// Make sure the styles array exists.
// In some contexts, like the navigation editor, it doesn't.
if ( ! isset( $settings['styles'] ) ) {
$settings['styles'] = array();
}

// Reset existing global styles.
foreach ( $settings['styles'] as $key => $style ) {
if ( isset( $style['__unstableType'] ) && 'globalStyles' === $style['__unstableType'] ) {
Expand Down

0 comments on commit f9eb406

Please sign in to comment.