Skip to content

TypeError: Cannot read properties of undefined (reading '31')  #4545

@SimonSiefke

Description

@SimonSiefke

Details

  • Browser and browser version: VSCode
  • OS version: Ubuntu 23.04
  • xterm.js version: 5.2.0-beta.35

Steps to reproduce

I'm not quite sure of any consistent reproduction steps, but

  1. I was using the VSCode terminal as usual
  2. noticed high cpu load and then
  3. opened devtools and saw this error (~250 times)
workbench.js:2699 [uncaught exception]: TypeError: Cannot read properties of undefined (reading '31')
workbench.js:2702 TypeError: Cannot read properties of undefined (reading '31')
    at g._setCellUnderline (DomRenderer.ts:388:33)
    at g._handleLinkLeave (DomRenderer.ts:384:10)
    at DomRenderer.ts:82:66
    at t.EventEmitter.fire (EventEmitter.ts:55:16)
    at c._fireUnderlineEvent (Linkifier2.ts:368:13)
    at c._linkLeave (Linkifier2.ts:375:14)
    at c._clearCurrentLink (Linkifier2.ts:263:12)
    at c._handleHover (Linkifier2.ts:115:12)
    at c._handleMouseMove (Linkifier2.ts:106:12)

Additional Information

VSCode issue: microsoft/vscode#184255

XTermjs code:

private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {
x = this._cellToRowElements[y][x];
x2 = this._cellToRowElements[y2][x2];

There might be an edge case in this code when y or y2 is larger than _cellToRowElements.length, then a TypeError is thrown. Another possibility could be that for some reason y or y2 is NaN . But it's still unclear to me why/when this would happen.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions