Skip to content

Commit

Permalink
protect against undefined session; fixes microsoft#69128
Browse files Browse the repository at this point in the history
  • Loading branch information
weinand authored and sandy081 committed Feb 22, 2019
1 parent 3ff6973 commit 69526f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
6 changes: 5 additions & 1 deletion src/vs/workbench/api/node/extHostDebugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {

public async $acceptDebugSessionStarted(sessionDto: IDebugSessionDto): Promise<void> {
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<void> {
Expand Down

0 comments on commit 69526f5

Please sign in to comment.