1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-13 13:18:43 +02:00

Merge pull request #4538 from kaja47/fix-crash-when-losing

fix crash when computer player loses
This commit is contained in:
Ivan Savenko 2024-08-30 14:16:33 +03:00 committed by GitHub
commit 07ce8ae1ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1066,10 +1066,13 @@ void CGameHandler::setOwner(const CGObjectInstance * obj, const PlayerColor owne
if ((obj->ID == Obj::CREATURE_GENERATOR1 || obj->ID == Obj::CREATURE_GENERATOR4))
{
for (const CGTownInstance * t : getPlayerState(owner)->getTowns())
if (owner.isValidPlayer())
{
if (t->hasBuilt(BuildingSubID::PORTAL_OF_SUMMONING))
setPortalDwelling(t);//set initial creatures for all portals of summoning
for (const CGTownInstance * t : getPlayerState(owner)->getTowns())
{
if (t->hasBuilt(BuildingSubID::PORTAL_OF_SUMMONING))
setPortalDwelling(t);//set initial creatures for all portals of summoning
}
}
}
}