Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug: Fix setConfiguration error when name is null or undefined #7636

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/vs/workbench/parts/debug/node/debugConfigurationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import nls = require('vs/nls');
import { sequence } from 'vs/base/common/async';
import { TPromise } from 'vs/base/common/winjs.base';
import strings = require('vs/base/common/strings');
import types = require('vs/base/common/types');
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import Event, { Emitter } from 'vs/base/common/event';
import objects = require('vs/base/common/objects');
Expand Down Expand Up @@ -287,21 +288,20 @@ export class ConfigurationManager implements debug.IConfigurationManager {

public setConfiguration(nameOrConfig: string|debug.IConfig): TPromise<void> {
return this.loadLaunchConfig().then(config => {
if (typeof nameOrConfig === 'string' && (!config || !config.configurations)) {
this.configuration = null;
return;
}

if (typeof nameOrConfig === 'string') {
if (types.isObject(nameOrConfig)) {
this.configuration = objects.deepClone(nameOrConfig) as debug.IConfig;
} else {
if (!config || !config.configurations) {
this.configuration = null;
return;
}
// if the configuration name is not set yet, take the first launch config (can happen if debug viewlet has not been opened yet).
const filtered = nameOrConfig ? config.configurations.filter(cfg => cfg.name === nameOrConfig) : [config.configurations[0]];

this.configuration = filtered.length === 1 ? objects.deepClone(filtered[0]) : null;
if (config && this.configuration) {
this.configuration.debugServer = config.debugServer;
}
} else {
this.configuration = objects.deepClone(nameOrConfig);
}

if (this.configuration) {
Expand Down