mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
fix: time-of-check-to-time-of-use (TOCTOU) race condition in AIMemory::removeInvisibleObjects; a bit of refactoring in RecruitHeroBehavior and some todo comments for later on
This commit is contained in:
@@ -94,8 +94,9 @@ void ObjectGraph::removeObject(const CGObjectInstance * obj, CCallback & cc)
|
||||
|
||||
void ObjectGraph::connectHeroes(const Nullkiller * aiNk)
|
||||
{
|
||||
for(auto obj : aiNk->memory->visitableObjs)
|
||||
for(const ObjectInstanceID objId : aiNk->memory->visitableObjs)
|
||||
{
|
||||
const CGObjectInstance * obj = aiNk->cc->getObj(objId, false);
|
||||
if(obj && obj->ID == Obj::HERO)
|
||||
{
|
||||
addObject(obj);
|
||||
|
||||
Reference in New Issue
Block a user