mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
CGSubterraneanGate: fix crash on initialization
There is some reason it's appear in campaign maps.
This commit is contained in:
parent
f1e5797834
commit
ee7862b12f
@ -1154,6 +1154,9 @@ void CGSubterraneanGate::postInit() //matches subterranean gates into pairs
|
|||||||
std::vector<CGSubterraneanGate *> gatesSplit[2]; //surface and underground gates
|
std::vector<CGSubterraneanGate *> gatesSplit[2]; //surface and underground gates
|
||||||
for(auto & obj : cb->gameState()->map->objects)
|
for(auto & obj : cb->gameState()->map->objects)
|
||||||
{
|
{
|
||||||
|
if(!obj) // FIXME: Find out why there are nullptr objects right after initialization
|
||||||
|
continue;
|
||||||
|
|
||||||
auto hlp = dynamic_cast<CGSubterraneanGate *>(cb->gameState()->getObjInstance(obj->id));
|
auto hlp = dynamic_cast<CGSubterraneanGate *>(cb->gameState()->getObjInstance(obj->id));
|
||||||
if(hlp)
|
if(hlp)
|
||||||
gatesSplit[hlp->pos.z].push_back(hlp);
|
gatesSplit[hlp->pos.z].push_back(hlp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user