From 4215ed797c3cc009bcfe98a53903d7727432ce4c Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Thu, 21 Feb 2019 11:40:50 +0100 Subject: [PATCH] protect against undefined session; fixes #69128 --- .../api/electron-browser/mainThreadDebugService.ts | 6 +++++- src/vs/workbench/api/node/extHostDebugService.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts index 80b8a12bc42..395c6b87b0e 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDebugService.ts @@ -36,7 +36,11 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDebugService); this._toDispose = []; this._toDispose.push(debugService.onDidNewSession(session => { - this._proxy.$acceptDebugSessionStarted(this.getSessionDto(session)); + if (session) { + this._proxy.$acceptDebugSessionStarted(this.getSessionDto(session)); + } else { + console.error('undefined session received in onDidNewSession'); + } })); // Need to start listening early to new session events because a custom event can come while a session is initialising this._toDispose.push(debugService.onWillNewSession(session => { diff --git a/src/vs/workbench/api/node/extHostDebugService.ts b/src/vs/workbench/api/node/extHostDebugService.ts index f4ef3fc28b6..d8a11d09843 100644 --- a/src/vs/workbench/api/node/extHostDebugService.ts +++ b/src/vs/workbench/api/node/extHostDebugService.ts @@ -593,7 +593,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape { public async $acceptDebugSessionStarted(sessionDto: IDebugSessionDto): Promise { const session = await this.getSession(sessionDto); - this._onDidStartDebugSession.fire(session); + if (session) { + this._onDidStartDebugSession.fire(session); + } else { + console.error('undefined session received in acceptDebugSessionStarted'); // should not happen (but see #69128) + } } public async $acceptDebugSessionTerminated(sessionDto: IDebugSessionDto): Promise {