Skip to content

Commit 5e80310

Browse files
author
Daniel Kroening
committed
add invariant on parent-child class relationship
1 parent 18d08bf commit 5e80310

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/goto-programs/class_hierarchy.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ void class_hierarchy_grapht::populate(const symbol_tablet &symbol_table)
5050
const irep_idt &parent = to_symbol_type(base.type()).get_identifier();
5151
if(!parent.empty())
5252
{
53-
add_edge(
54-
nodes_by_name.at(parent), nodes_by_name.at(symbol_pair.first));
53+
const auto parent_node_it = nodes_by_name.find(parent);
54+
DATA_INVARIANT(
55+
parent_node_it != nodes_by_name.end(),
56+
"parent class not in symbol table");
57+
add_edge(parent_node_it->second, nodes_by_name.at(symbol_pair.first));
5558
}
5659
}
5760
}

0 commit comments

Comments
 (0)