diff --git a/extensions/notebook/src/book/bookTreeView.ts b/extensions/notebook/src/book/bookTreeView.ts index f8d989f387..948d516150 100644 --- a/extensions/notebook/src/book/bookTreeView.ts +++ b/extensions/notebook/src/book/bookTreeView.ts @@ -86,7 +86,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider { - let notebook = this.currentBook.getNotebook(document.uri.fsPath); + let notebook = this.currentBook?.getNotebook(document.uri.fsPath); if (notebook && this._bookTrustManager.isNotebookTrustedByDefault(document.uri.fsPath)) { document.setTrusted(true); } @@ -235,10 +235,10 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider { - if (this.currentBook.bookPath) { + if (this.currentBook?.bookPath) { const allFilesFilter = loc.allFiles; let filter: any = {}; filter[allFilesFilter] = '*';