From cfd4de10ab170a244cc226df3e6bed30046275a8 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Fri, 30 Aug 2024 12:34:12 +1000 Subject: [PATCH] Ensure to check if editor is undefined in nb diff view (#227174) --- .../workbench/contrib/notebook/browser/diff/diffComponents.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts b/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts index 32b1b2c2de5..a8f2c46ccef 100644 --- a/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts +++ b/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts @@ -1074,7 +1074,7 @@ export class DeletedElement extends SingleSideDiffElement { layout(state: IDiffElementLayoutState) { DOM.scheduleAtNextAnimationFrame(DOM.getWindow(this._diffEditorContainer), () => { - if (state.editorHeight || state.outerWidth) { + if ((state.editorHeight || state.outerWidth) && this._editor) { this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`; this._editor.layout({ width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false), @@ -1254,7 +1254,7 @@ export class InsertElement extends SingleSideDiffElement { layout(state: IDiffElementLayoutState) { DOM.scheduleAtNextAnimationFrame(DOM.getWindow(this._diffEditorContainer), () => { - if (state.editorHeight || state.outerWidth) { + if ((state.editorHeight || state.outerWidth) && this._editor) { this._editorContainer.style.height = `${this.cell.layoutInfo.editorHeight}px`; this._editor.layout({ width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),