diff --git a/src/sql/workbench/parts/notebook/browser/models/notebookInput.ts b/src/sql/workbench/parts/notebook/browser/models/notebookInput.ts index a986574f15..c1b12a75f4 100644 --- a/src/sql/workbench/parts/notebook/browser/models/notebookInput.ts +++ b/src/sql/workbench/parts/notebook/browser/models/notebookInput.ts @@ -398,7 +398,7 @@ export class NotebookInput extends EditorInput { } public dispose(): void { - if (this._model) { + if (this._model && this._model.editorModel && this._model.editorModel.textEditorModel) { this._model.editorModel.textEditorModel.onBeforeDetached(); } this._disposeContainer();