debug: null guards that help when launching invalid js

This commit is contained in:
isidor
2016-07-21 17:12:27 +02:00
parent d2bc1eb8f7
commit adcd4e9f29
2 changed files with 9 additions and 1 deletions

View File

@@ -632,6 +632,10 @@ export class DebugService implements debug.IDebugService {
this.model.setExceptionBreakpoints(this.session.configuration.capabilities.exceptionBreakpointFilters);
return configuration.request === 'attach' ? this.session.attach(configuration) : this.session.launch(configuration);
}).then((result: DebugProtocol.Response) => {
if (!this.session) {
return TPromise.as(null);
}
if (configuration.internalConsoleOptions === 'openOnSessionStart' || (!this.viewModel.changedWorkbenchViewState && configuration.internalConsoleOptions !== 'neverOpen')) {
this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
@@ -942,6 +946,7 @@ export class DebugService implements debug.IDebugService {
private lazyTransitionToRunningState(threadId?: number): void {
let setNewFocusedStackFrameScheduler: RunOnceScheduler;
const toDispose = this.session.onDidStop(e => {
if (e.body.threadId === threadId || e.body.allThreadsStopped || !threadId) {
setNewFocusedStackFrameScheduler.cancel();

View File

@@ -221,7 +221,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
}
private readCapabilities(response: DebugProtocol.Response): DebugProtocol.Response {
this.capabilities = objects.mixin(this.capabilities, response.body);
if (response) {
this.capabilities = objects.mixin(this.capabilities, response.body);
}
return response;
}