Sanity check lines[y] to fix exception

Fixes #105333
This commit is contained in:
Daniel Imms
2020-08-26 06:50:09 -07:00
parent 995302fd69
commit b2b71a8296
@@ -54,6 +54,12 @@ export function convertLinkRangeToBuffer(lines: IBufferLine[], bufferWidth: numb
const startLineOffset = (y === startWrappedLineCount - 1 ? startOffset : 0);
let lineOffset = 0;
const line = lines[y];
// Sanity check for line, apparently this can happen but it's not clear under what
// circumstances this happens. Continue on, skipping the remainder of start offset if this
// happens to minimize impact.
if (!line) {
break;
}
for (let x = start; x < Math.min(bufferWidth, lineLength + lineOffset + startLineOffset); x++) {
const cell = line.getCell(x)!;
const width = cell.getWidth();