Skip to content

Commit 265227e

Browse files
authored
Merge pull request #3604 from Tyriar/exception_3602
Prevent exception being thrown in reflow smaller
2 parents 58b7a4a + 1d3c196 commit 265227e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/common/buffer/Buffer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,11 @@ export class Buffer implements IBuffer {
367367
let srcCol = lastLineLength;
368368
while (srcLineIndex >= 0) {
369369
const cellsToCopy = Math.min(srcCol, destCol);
370+
if (wrappedLines[destLineIndex] === undefined) {
371+
// Sanity check that the line exists, this has been known to fail for an unknown reason
372+
// which would stop the reflow from happening if an exception would throw.
373+
break;
374+
}
370375
wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);
371376
destCol -= cellsToCopy;
372377
if (destCol === 0) {

0 commit comments

Comments
 (0)