[graph] Minor restructure a condition
diff --git a/src/graph/graph.hh b/src/graph/graph.hh
index 929b822..595def5 100644
--- a/src/graph/graph.hh
+++ b/src/graph/graph.hh
@@ -298,12 +298,10 @@
return;
}
- unsigned *v;
- if (parents.has (old_index, &v))
- {
- if (parents.set (new_index, *v))
- parents.del (old_index);
- }
+ const unsigned *v;
+ if (parents.has (old_index, &v) &&
+ parents.set (new_index, *v))
+ parents.del (old_index);
}
bool is_leaf () const
@@ -1207,6 +1205,7 @@
unsigned space_for (unsigned index, unsigned* root = nullptr) const
{
+ assert (index < vertices_.length);
const auto& node = vertices_[index];
if (node.space)
{