diff --git a/include/boost/graph/detail/adjacency_list.hpp b/include/boost/graph/detail/adjacency_list.hpp index 6fb497d7..a8c92df1 100644 --- a/include/boost/graph/detail/adjacency_list.hpp +++ b/include/boost/graph/detail/adjacency_list.hpp @@ -2058,13 +2058,17 @@ namespace boost { { typename EdgeList::iterator ei = el.begin(), e_end = el.end(); while (ei != e_end) { - typename EdgeList::value_type ce = *ei; - ++ei; - if (ce.get_target() > u) { + if (ei->get_target() > u) { + typename EdgeList::value_type ce = *ei; + ++ei; el.erase(ce); --ce.get_target(); el.insert(ce); } + else + { + ++ei; + } } } } // namespace detail