diff --git a/src/Tree/tree.cpp b/src/Tree/tree.cpp index 48f88ef..b503320 100644 --- a/src/Tree/tree.cpp +++ b/src/Tree/tree.cpp @@ -18,6 +18,7 @@ along with this program. If not, see . #include #include #include +#include #include std::list>::const_iterator Tree::BaseNode::getChildIterator(const std::shared_ptr child) const @@ -132,7 +133,10 @@ void Tree::BaseNode::deleteChildren() { if ((*it) != nullptr ) { + auto prev = std::prev(it); deleteChild((*it)); + it=prev; + } }