Skip to content

Commit

Permalink
Add optional chaining to prevent exception if activeFormats not defin…
Browse files Browse the repository at this point in the history
…ed (#32526) (#32527)

Co-authored-by: Glen Davies <glen.davies@a8c.com>
  • Loading branch information
2 people authored and WunderBart committed Jun 29, 2021
1 parent ae04f4c commit b3e88da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/rich-text/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { regexp } from '@wordpress/shortcode';
import deprecated from '@wordpress/deprecated';

export function addActiveFormats( value, activeFormats ) {
if ( activeFormats.length ) {
if ( activeFormats?.length ) {
let index = value.formats.length;

while ( index-- ) {
Expand Down

0 comments on commit b3e88da

Please sign in to comment.