diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index 1d7da64f539..cf42eee83d2 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -346,7 +346,7 @@ export class MainThreadWebview implements MainThreadWebviewShape { private onEditorsChanged() { const activeEditor = this._editorService.getActiveEditor(); let newActiveWebview: WebviewInput | undefined = undefined; - if (activeEditor.input instanceof WebviewInput) { + if (activeEditor && activeEditor.input instanceof WebviewInput) { for (const handle of map.keys(this._webviews)) { const input = this._webviews.get(handle); if (input.matches(activeEditor.input)) {