Use vector::at() when the index may not exist

To avoid invoking undefined behaviour.
This commit is contained in:
Oliver Hamlet
2022-02-07 20:25:14 +00:00
parent 2e8230f063
commit aec64ffaa1
+3 -1
View File
@@ -206,7 +206,9 @@ GetTransitiveAfterGroups(const std::vector<Group>& masterlistGroups,
// Create a color map.
std::vector<boost::default_color_type> colorVec(boost::num_vertices(graph));
auto colorMap = boost::make_iterator_property_map(
colorVec.begin(), boost::get(boost::vertex_index, graph), colorVec[0]);
colorVec.begin(),
boost::get(boost::vertex_index, graph),
colorVec.at(0));
boost::depth_first_visit(graph, vertex, afterGroupsVisitor, colorMap);
transitiveAfterGroups[graph[vertex]] = visitedGroups;