From fafb770ca58fc8c89fec852559ff00a9e1ca8e37 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 26 Jan 2017 21:30:16 +0100 Subject: 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 --- utils/regtools/lib/soc_desc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/regtools/lib/soc_desc.cpp b/utils/regtools/lib/soc_desc.cpp index 1cfbdac1f4..113d6b1dd4 100644 --- a/utils/regtools/lib/soc_desc.cpp +++ b/utils/regtools/lib/soc_desc.cpp @@ -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; } -- cgit