Commit 984e0102 authored by Ben Boeckel's avatar Ben Boeckel

HyperTree example: use the iterator before invalidating it

Change-Id: I88b20ac27e198a759d1c9a1c8d9e4b6ddc1d3da6
parent 7de9cf0b
......@@ -124,8 +124,8 @@ void Cell::replaceNode (Node* oldNode, Node* newNode)
vector<Node*>::iterator it = std::find (_nodes.begin(), _nodes.end(), oldNode);
if (it != _nodes.end())
{
_nodes.erase (it);
_nodes.insert (it, newNode);
_nodes.erase (it);
oldNode->unregisterCell (this);
newNode->registerCell (this);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment