FIX: fixed segmentation fault when deleting all children
This commit is contained in:
parent
1cbb6c108e
commit
86bb4baaf8
@ -18,6 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <Tree/tree.hpp>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
std::list<std::shared_ptr<Tree::BaseNode>>::const_iterator Tree::BaseNode::getChildIterator(const std::shared_ptr<const Tree::BaseNode> child) const
|
||||
@ -132,7 +133,10 @@ void Tree::BaseNode::deleteChildren()
|
||||
{
|
||||
if ((*it) != nullptr )
|
||||
{
|
||||
auto prev = std::prev(it);
|
||||
deleteChild((*it));
|
||||
it=prev;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user