diff --git a/node_modules/prosemirror-model/dist/index.cjs b/node_modules/prosemirror-model/dist/index.cjs
index aa31355..dcb4a75 100644
--- a/node_modules/prosemirror-model/dist/index.cjs
+++ b/node_modules/prosemirror-model/dist/index.cjs
@@ -95,6 +95,7 @@ var Fragment = function () {
       var nodeStart = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
       var parent = arguments.length > 4 ? arguments[4] : undefined;
       for (var i = 0, pos = 0; pos < to; i++) {
+        if (i >= this.content.length) break;
         var child = this.content[i],
           end = pos + child.nodeSize;
         if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
diff --git a/node_modules/prosemirror-model/dist/index.js b/node_modules/prosemirror-model/dist/index.js
index 0097d9f..44f7d4a 100644
--- a/node_modules/prosemirror-model/dist/index.js
+++ b/node_modules/prosemirror-model/dist/index.js
@@ -84,6 +84,7 @@ class Fragment {
     */
     nodesBetween(from, to, f, nodeStart = 0, parent) {
         for (let i = 0, pos = 0; pos < to; i++) {
+            if (i >= this.content.length) break;
             let child = this.content[i], end = pos + child.nodeSize;
             if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
                 let start = pos + 1;
