Skip to content

Commit b2b71a8

Browse files
committed
Sanity check lines[y] to fix exception
Fixes microsoft#105333
1 parent 995302f commit b2b71a8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/vs/workbench/contrib/terminal/browser/links/terminalLinkHelpers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ export function convertLinkRangeToBuffer(lines: IBufferLine[], bufferWidth: numb
5454
const startLineOffset = (y === startWrappedLineCount - 1 ? startOffset : 0);
5555
let lineOffset = 0;
5656
const line = lines[y];
57+
// Sanity check for line, apparently this can happen but it's not clear under what
58+
// circumstances this happens. Continue on, skipping the remainder of start offset if this
59+
// happens to minimize impact.
60+
if (!line) {
61+
break;
62+
}
5763
for (let x = start; x < Math.min(bufferWidth, lineLength + lineOffset + startLineOffset); x++) {
5864
const cell = line.getCell(x)!;
5965
const width = cell.getWidth();

0 commit comments

Comments
 (0)