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
glendaviesnz and Glen Davies committed Jun 21, 2021
1 parent d3b9608 commit 6885a43
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 6885a43

Please sign in to comment.