regtools/soc_desc: fix bug in library

Because a node ref is at root doesn't make it valid, check that soc is valid
otherwise we return garbage.

Change-Id: I6e5befc959dc670ab39a87484e87af6d90be7726
This commit is contained in:
Amaury Pouly 2017-01-26 21:30:16 +01:00
parent 6f0f1193e5
commit fafb770ca5
1 changed files with 1 additions and 1 deletions

View File

@ -1035,7 +1035,7 @@ namespace
std::vector< node_t > *get_children(node_ref_t node)
{
if(node.is_root())
return &node.soc().get()->node;
return node.soc().valid() ? &node.soc().get()->node : 0;
node_t *n = node.get();
return n == 0 ? 0 : &n->node;
}