diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index 0f18a233ed..e6d259c289 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -203,11 +203,14 @@ export class RenderService extends Disposable implements IRenderService { public setRenderer(renderer: IRenderer): void { this._renderer.value = renderer; - this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true)); + // If the value was not set, the terminal is being disposed so ignore it + if (this._renderer.value) { + this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, true)); - // Force a refresh - this._needsSelectionRefresh = true; - this._fullRefresh(); + // Force a refresh + this._needsSelectionRefresh = true; + this._fullRefresh(); + } } public addRefreshCallback(callback: FrameRequestCallback): number {