From fd684a2ac5736a9468dd606a56a7f13498ddab93 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Mon, 18 Sep 2023 12:03:58 +0200 Subject: [PATCH] Fixes #193194 --- .../diff/defaultLinesDiffComputer/computeMovedLines.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts b/src/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts index 6436ad0d9e097..2d25234c4e5f4 100644 --- a/src/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts +++ b/src/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts @@ -196,6 +196,9 @@ function computeUnchangedMoves( for (extendToTop = 0; extendToTop < linesAbove; extendToTop++) { const origLine = move.original.startLineNumber - extendToTop - 1; const modLine = move.modified.startLineNumber - extendToTop - 1; + if (origLine > originalLines.length || modLine > modifiedLines.length) { + break; + } if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) { break; } @@ -213,6 +216,9 @@ function computeUnchangedMoves( for (extendToBottom = 0; extendToBottom < linesBelow; extendToBottom++) { const origLine = move.original.endLineNumberExclusive + extendToBottom; const modLine = move.modified.endLineNumberExclusive + extendToBottom; + if (origLine > originalLines.length || modLine > modifiedLines.length) { + break; + } if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) { break; }