Fix varListChildren() when there are no children
Return [] instead of throwing exception.
This commit is contained in:
parent
ca0f86a37c
commit
c313af85b2
1 changed files with 1 additions and 1 deletions
|
|
@ -679,7 +679,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
this.log("stderr", "varListChildren");
|
this.log("stderr", "varListChildren");
|
||||||
//TODO: add `from` and `to` arguments
|
//TODO: add `from` and `to` arguments
|
||||||
const res = await this.sendCommand(`var-list-children --all-values ${name}`);
|
const res = await this.sendCommand(`var-list-children --all-values ${name}`);
|
||||||
const children = res.result("children");
|
const children = res.result("children") || [];
|
||||||
let omg: VariableObject[] = children.map(child => new VariableObject(child[1]));
|
let omg: VariableObject[] = children.map(child => new VariableObject(child[1]));
|
||||||
return omg;
|
return omg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue