From 02bc210f56a55505650835c151b793c259662d86 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 7 Jan 2021 13:06:23 +0200 Subject: [PATCH] Catch xtermjs fit error (#1907) Signed-off-by: Jari Kolehmainen --- src/renderer/components/dock/terminal.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/dock/terminal.ts b/src/renderer/components/dock/terminal.ts index a4246658fe..6de16721d6 100644 --- a/src/renderer/components/dock/terminal.ts +++ b/src/renderer/components/dock/terminal.ts @@ -130,10 +130,17 @@ export class Terminal { fit = () => { // Since this function is debounced we need to read this value as late as possible if (!this.isActive) return; - this.fitAddon.fit(); - const { cols, rows } = this.xterm; - this.api.sendTerminalSize(cols, rows); + try { + this.fitAddon.fit(); + const { cols, rows } = this.xterm; + + this.api.sendTerminalSize(cols, rows); + } catch(error) { + console.error(error); + + return; // see https://github.com/lensapp/lens/issues/1891 + } }; fitLazy = debounce(this.fit, 250);