From fd23d875fa6ea2e03c13bc44e09c58860fd2e82b Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Wed, 11 Aug 2021 17:54:29 +0200 Subject: [PATCH] Rich text - toTree - Add optional chaining in replacements before accessing its type --- packages/rich-text/src/to-tree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rich-text/src/to-tree.js b/packages/rich-text/src/to-tree.js index 33ef9b6a185f7..29de04f0016b6 100644 --- a/packages/rich-text/src/to-tree.js +++ b/packages/rich-text/src/to-tree.js @@ -287,7 +287,7 @@ export function toTree( { } if ( character === OBJECT_REPLACEMENT_CHARACTER ) { - if ( ! isEditableTree && replacements[ i ].type === 'script' ) { + if ( ! isEditableTree && replacements[ i ]?.type === 'script' ) { pointer = append( getParent( pointer ), fromFormat( {