From 5c9adeef930b969bc822470b504ae690d82dd05e Mon Sep 17 00:00:00 2001 From: ElJeffe Date: Tue, 26 Oct 2021 11:44:52 -0400 Subject: [PATCH] Check to make sure cols & rows are INT I've noticed that if the terminal is hidden and the screen experiences a resize trigger from a blur / focus, it can cause the dimensions to be undefined. This creates an exception in Xterm.js that the values are not integers. Figured it would be ok to just check before doing a resize. --- addons/xterm-addon-fit/src/FitAddon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/xterm-addon-fit/src/FitAddon.ts b/addons/xterm-addon-fit/src/FitAddon.ts index f4e5c772..360397ec 100644 --- a/addons/xterm-addon-fit/src/FitAddon.ts +++ b/addons/xterm-addon-fit/src/FitAddon.ts @@ -33,7 +33,7 @@ export class FitAddon implements ITerminalAddon { public fit(): void { const dims = this.proposeDimensions(); - if (!dims || !this._terminal) { + if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) { return; }