Fixed crash on vertex_remove
This commit is contained in:
parent
39db9b6c12
commit
a77a8575c5
|
@ -143,10 +143,9 @@ void Graph::remove_vertex(Vertex* target)
|
||||||
for (cursor = target->neighbors.begin(); cursor != target->neighbors.end();
|
for (cursor = target->neighbors.begin(); cursor != target->neighbors.end();
|
||||||
cursor++)
|
cursor++)
|
||||||
{
|
{
|
||||||
Vertex* neighbor = *cursor;
|
|
||||||
list<Vertex*>::iterator subcursor = find(target->neighbors.begin(),
|
list<Vertex*>::iterator subcursor = find(target->neighbors.begin(),
|
||||||
target->neighbors.end(),
|
target->neighbors.end(),
|
||||||
target);
|
*cursor);
|
||||||
assert(subcursor != target->neighbors.end());
|
assert(subcursor != target->neighbors.end());
|
||||||
target->neighbors.erase(subcursor);
|
target->neighbors.erase(subcursor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user