diff --git a/src/ytype.js b/src/ytype.js index 52485272..720bf3d9 100644 --- a/src/ytype.js +++ b/src/ytype.js @@ -1047,7 +1047,7 @@ export class YType { deleteText(transaction, currPos, op.delete) } else if (delta.$modifyOp.check(op)) { let item = currPos.right - while (item?.deleted && !item.countable) { item = item.next } + while (item != null && (item.deleted || !item.countable)) { item = item.next } if (item == null || item.content.constructor !== ContentType) { error.unexpectedCase() } /** @type {ContentType} */ (item.content).type.applyDelta(op.value) currPos.formatText(transaction, /** @type {any} */ (this), 1, op.format || {})