summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-26 21:30:16 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-02-04 17:18:37 +0100
commitfafb770ca58fc8c89fec852559ff00a9e1ca8e37 (patch)
tree2d0b1757c168c9107dac45f70efade1981916031
parent6f0f1193e549245f3b4ac77c8875a40652286d1e (diff)
downloadrockbox-fafb770ca58fc8c89fec852559ff00a9e1ca8e37.tar.gz
rockbox-fafb770ca58fc8c89fec852559ff00a9e1ca8e37.zip
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
-rw-r--r--utils/regtools/lib/soc_desc.cpp2
1 files changed, 1 insertions, 1 deletions
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
1035std::vector< node_t > *get_children(node_ref_t node) 1035std::vector< node_t > *get_children(node_ref_t node)
1036{ 1036{
1037 if(node.is_root()) 1037 if(node.is_root())
1038 return &node.soc().get()->node; 1038 return node.soc().valid() ? &node.soc().get()->node : 0;
1039 node_t *n = node.get(); 1039 node_t *n = node.get();
1040 return n == 0 ? 0 : &n->node; 1040 return n == 0 ? 0 : &n->node;
1041} 1041}