From 7ffde0b274d84fa481f821521cbc58d5c3209e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 31 Aug 2021 15:52:55 +0200 Subject: [PATCH] Remove the non-null assertion on `IDebugger.ISources` Fixes #10975 --- packages/debugger/src/service.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/debugger/src/service.ts b/packages/debugger/src/service.ts index 10fb56866f60..ab712dfc0f3d 100644 --- a/packages/debugger/src/service.ts +++ b/packages/debugger/src/service.ts @@ -469,15 +469,17 @@ export class DebuggerService implements IDebugger, IDisposable { getDebuggerState(): IDebugger.State { const breakpoints = this._model.breakpoints.breakpoints; let cells: string[] = []; - for (const id of breakpoints.keys()) { - const editorList = this._debuggerSources!.find({ - focus: false, - kernel: this.session?.connection?.kernel?.name ?? '', - path: this._session?.connection?.path ?? '', - source: id - }); - const tmpCells = editorList.map(e => e.model.value.text); - cells = cells.concat(tmpCells); + if (this._debuggerSources) { + for (const id of breakpoints.keys()) { + const editorList = this._debuggerSources.find({ + focus: false, + kernel: this.session?.connection?.kernel?.name ?? '', + path: this._session?.connection?.path ?? '', + source: id + }); + const tmpCells = editorList.map(e => e.model.value.text); + cells = cells.concat(tmpCells); + } } return { cells, breakpoints }; }