From 25c0fb7f2f608207710d4996ac09a7590fbcd9ad Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 18 Feb 2021 15:36:07 -0800 Subject: [PATCH] Fix _getViewIndexUpperBound throwing if the view model is undefined Return -1 instead, which the callers check --- .../contrib/notebook/browser/view/notebookCellList.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts index 1f0f7990622..72a6fac7b31 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts @@ -534,7 +534,11 @@ export class NotebookCellList extends WorkbenchList implements ID private _getViewIndexUpperBound(cell: ICellViewModel): number { - const modelIndex = this._viewModel!.getCellIndex(cell); + if (!this._viewModel) { + return -1; + } + + const modelIndex = this._viewModel.getCellIndex(cell); if (!this.hiddenRangesPrefixSum) { return modelIndex; } -- GitLab