From 73d9b7f22a5ee65fe54b1cee309a71d5adec83c3 Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Wed, 26 Feb 2020 11:17:56 -0800 Subject: [PATCH] Check if notebook model is undefined in setTrustForNewEditor. (#9312) --- .../contrib/notebook/browser/models/notebookInput.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts b/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts index bd27ddc5ef..f7f1a21433 100644 --- a/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts +++ b/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts @@ -299,8 +299,8 @@ export abstract class NotebookInput extends EditorInput { } private async setTrustForNewEditor(newInput: IEditorInput | undefined): Promise { - let isTrusted = this._model.getNotebookModel().trustedMode; - if (isTrusted && newInput && newInput.resource !== this.resource) { + let model = this._model.getNotebookModel(); + if (model?.trustedMode && newInput?.resource !== this.resource) { await this.notebookService.serializeNotebookStateChange(newInput.resource, NotebookChangeType.Saved, undefined, true); } }