fixed conditional erase exception
This commit is contained in:
parent
e80cfee1fe
commit
36ba857b0d
|
@ -19,10 +19,12 @@ namespace lol
|
||||||
|
|
||||||
void ObjectManager::ClearUnused()
|
void ObjectManager::ClearUnused()
|
||||||
{
|
{
|
||||||
for(const auto& [key, value] : objects)
|
for(std::map<unsigned int, std::shared_ptr<void>>::iterator it = objects.begin(); it != objects.end();)
|
||||||
{
|
{
|
||||||
if(value.unique())
|
if (it->second.unique())
|
||||||
objects.erase(key);
|
it = objects.erase(it);
|
||||||
|
else
|
||||||
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue