Skip to content

Commit 7637a2d

Browse files
authored
Merge pull request #5386 from alexkozy/safe-guards
fix: ensure that currentRow can not go out of the range
2 parents 4c0cf27 + a589be2 commit 7637a2d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/browser/input/MoveToCell.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ function bufferLine(
199199
let currentRow = startRow;
200200
let bufferStr = '';
201201

202-
while (currentCol !== endCol || currentRow !== endRow) {
202+
while ((currentCol !== endCol || currentRow !== endRow) &&
203+
currentRow >= 0 &&
204+
currentRow < bufferService.buffer.lines.length) {
203205
currentCol += forward ? 1 : -1;
204206

205207
if (forward && currentCol > bufferService.cols - 1) {

0 commit comments

Comments
 (0)