Commit 86fe3ff9 authored by David Thompson's avatar David Thompson
Browse files

Fix bad shared_ptr dereference.

Always verify that map entries exist before accessing the shared
pointer held by the map.
parent aa7558bf
...@@ -662,12 +662,15 @@ struct Neighborhood ...@@ -662,12 +662,15 @@ struct Neighborhood
winner = this->m_regionIds.mergeSets(idA, idB); winner = this->m_regionIds.mergeSets(idA, idB);
RegionIdSet::value_type loser = (winner == idA ? idB : idA); RegionIdSet::value_type loser = (winner == idA ? idB : idA);
// If this is a new region, create a record for it. // If this is a new region, create a record for it.
if (!this->m_regions[winner]) if (this->m_regions.find(winner) == this->m_regions.end())
{ {
this->m_regions[winner] = smtk::make_shared<Region>(*ringB, !isOutB); this->m_regions[winner] = smtk::make_shared<Region>(*ringB, !isOutB);
} }
this->m_regions[winner]->merge(this->m_regions[loser].get()); if (this->m_regions.find(loser) != this->m_regions.end())
this->m_regions.erase(loser); {
this->m_regions[winner]->merge(this->m_regions[loser].get());
this->m_regions.erase(loser);
}
} }
else else
{ // Add coedges (of exiting edges on inside of A--B) to region. { // Add coedges (of exiting edges on inside of A--B) to region.
......
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