Skip to content

Commit 7db35be

Browse files
committed
Fix xdiff_string_patch#1
1 parent bc40856 commit 7db35be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions/xdiff/xdiff_string_patch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function xdiff_string_patch(originalStr, patch, flags, error) {
135135
}
136136
}
137137
}
138-
while (linePos < origLines.length) {
138+
while (linePos > 0 && linePos < origLines.length) {
139139
newStrArr[newStrArr.length] = origLines[linePos++];
140140
}
141141
} else if (flags & OPTS.XDIFF_PATCH_REVERSE) { // Only differs from above by a few lines
@@ -168,7 +168,7 @@ function xdiff_string_patch(originalStr, patch, flags, error) {
168168
}
169169
}
170170
}
171-
while (linePos < origLines.length) {
171+
while (linePos > 0 && linePos < origLines.length) {
172172
newStrArr[newStrArr.length] = origLines[linePos++];
173173
}
174174
}

0 commit comments

Comments
 (0)