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 <[email protected]>
  • Loading branch information
2 people authored and youknowriad committed Jun 24, 2021
1 parent 2819134 commit b7e51e7
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 b7e51e7

Please sign in to comment.