diff --git a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts index 4c2cda36b29ab10413b39e8014d8fcb3a0fbb3af..98e4459bf0b7a8bf35d4af2f064009ed82b81e56 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts @@ -113,12 +113,14 @@ class RunToCursorAction extends EditorAction { public run(accessor: ServicesAccessor, editor: ICodeEditor): TPromise { const debugService = accessor.get(IDebugService); - if (debugService.state !== State.Stopped) { + const focusedSession = debugService.getViewModel().focusedSession; + if (debugService.state !== State.Stopped || !focusedSession) { return Promise.resolve(null); } let breakpointToRemove: IBreakpoint; - const oneTimeListener = debugService.onDidChangeState(state => { + const oneTimeListener = focusedSession.onDidChangeState(() => { + const state = focusedSession.state; if (state === State.Stopped || state === State.Inactive) { if (breakpointToRemove) { debugService.removeBreakpoints(breakpointToRemove.getId());