mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
Changeset: Check .hasNext()
before calling .next()
This commit is contained in:
parent
1955e7b263
commit
44d99733c6
3 changed files with 6 additions and 4 deletions
|
@ -286,7 +286,7 @@ PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
|
|||
curLineOpIterLine = curLine;
|
||||
let indexIntoLine = 0;
|
||||
let done = false;
|
||||
while (!done) {
|
||||
while (!done && curLineOpIter.hasNext()) {
|
||||
curLineNextOp = curLineOpIter.next();
|
||||
if (indexIntoLine + curLineNextOp.chars >= curChar) {
|
||||
curLineNextOp.chars -= (curChar - indexIntoLine);
|
||||
|
@ -307,7 +307,7 @@ PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
|
|||
}
|
||||
|
||||
if (!curLineNextOp.chars) {
|
||||
curLineNextOp = curLineOpIter.next();
|
||||
curLineNextOp = curLineOpIter.hasNext() ? curLineOpIter.next() : Changeset.newOp();
|
||||
}
|
||||
|
||||
const charsToUse = Math.min(numChars, curLineNextOp.chars);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue