Skip to content

Commit c97abce

Browse files
authored
Merge pull request #5590 from Tyriar/5587
Add undefined checks in erase calls
2 parents ccf9727 + 9db31db commit c97abce

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/common/InputHandler.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,10 @@ export class InputHandler extends Disposable implements IInputHandler {
11541154
* @param respectProtect Whether to respect the protection attribute (DECSCA).
11551155
*/
11561156
private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {
1157-
const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;
1157+
const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);
1158+
if (!line) {
1159+
return;
1160+
}
11581161
line.replaceCells(
11591162
start,
11601163
end,
@@ -1224,7 +1227,10 @@ export class InputHandler extends Disposable implements IInputHandler {
12241227
this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);
12251228
if (this._activeBuffer.x + 1 >= this._bufferService.cols) {
12261229
// Deleted entire previous line. This next line can no longer be wrapped.
1227-
this._activeBuffer.lines.get(j + 1)!.isWrapped = false;
1230+
const nextLine = this._activeBuffer.lines.get(j + 1);
1231+
if (nextLine) {
1232+
nextLine.isWrapped = false;
1233+
}
12281234
}
12291235
while (j--) {
12301236
this._resetBufferLine(j, respectProtect);

0 commit comments

Comments
 (0)