From c313af85b28a58e018fb550caaaa27daefde6a8d Mon Sep 17 00:00:00 2001 From: gentoo90 Date: Sat, 10 Jun 2017 15:01:21 +0300 Subject: [PATCH] Fix varListChildren() when there are no children Return [] instead of throwing exception. --- src/backend/mi2/mi2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 18f45fb..18bd5ca 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -679,7 +679,7 @@ export class MI2 extends EventEmitter implements IBackend { this.log("stderr", "varListChildren"); //TODO: add `from` and `to` arguments 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])); return omg; }