Skip to content

Commit c313af8

Browse files
committed
Fix varListChildren() when there are no children
Return [] instead of throwing exception.
1 parent ca0f86a commit c313af8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/mi2/mi2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ export class MI2 extends EventEmitter implements IBackend {
679679
this.log("stderr", "varListChildren");
680680
//TODO: add `from` and `to` arguments
681681
const res = await this.sendCommand(`var-list-children --all-values ${name}`);
682-
const children = res.result("children");
682+
const children = res.result("children") || [];
683683
let omg: VariableObject[] = children.map(child => new VariableObject(child[1]));
684684
return omg;
685685
}

0 commit comments

Comments
 (0)