Checking if autorun exists & has items before iterating on it

This commit is contained in:
WebFreak001 2016-02-09 16:08:30 +01:00
commit d6c55d4aa8

View file

@ -83,6 +83,7 @@ class MI2DebugSession extends DebugSession {
this.attached = false; this.attached = false;
this.needContinue = false; this.needContinue = false;
this.gdbDebugger.load(args.cwd, args.target).then(() => { this.gdbDebugger.load(args.cwd, args.target).then(() => {
if (args.autorun)
args.autorun.forEach(command => { args.autorun.forEach(command => {
this.gdbDebugger.sendUserInput(command); this.gdbDebugger.sendUserInput(command);
}); });
@ -98,6 +99,7 @@ class MI2DebugSession extends DebugSession {
this.needContinue = true; this.needContinue = true;
if (args.remote) { if (args.remote) {
this.gdbDebugger.connect(args.cwd, args.executable, args.target).then(() => { this.gdbDebugger.connect(args.cwd, args.executable, args.target).then(() => {
if (args.autorun)
args.autorun.forEach(command => { args.autorun.forEach(command => {
this.gdbDebugger.sendUserInput(command); this.gdbDebugger.sendUserInput(command);
}); });
@ -106,6 +108,7 @@ class MI2DebugSession extends DebugSession {
} }
else { else {
this.gdbDebugger.attach(args.cwd, args.executable, args.target).then(() => { this.gdbDebugger.attach(args.cwd, args.executable, args.target).then(() => {
if (args.autorun)
args.autorun.forEach(command => { args.autorun.forEach(command => {
this.gdbDebugger.sendUserInput(command); this.gdbDebugger.sendUserInput(command);
}); });