diff --git a/src/types/YText.js b/src/types/YText.js index d1cdf781..71d6a030 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -498,8 +498,8 @@ const deleteText = (transaction, currPos, length) => { if (start) { cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes) } - const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right).parent) - if (parent._searchMarker) { + const parent = /** @type {AbstractType} */ (/** @type {Item} */ (currPos.left || currPos.right)?.parent) + if (parent?._searchMarker) { updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length) } return currPos