1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix null tile being processed in CGTownInstance::updateAppearance

This commit is contained in:
Michał Zaremba
2025-10-08 12:10:24 +02:00
parent ace5425433
commit 90924a74ef

View File

@@ -698,7 +698,15 @@ ObjectInstanceID CGTownInstance::getObjInstanceID() const
void CGTownInstance::updateAppearance()
{
auto terrain = cb->getTile(visitablePos())->getTerrainID();
const auto tile = cb->getTile(visitablePos());
if(!tile)
{
logGlobal->warn("Town is misplaced at (%d, %d, %d)", visitablePos().x,
visitablePos().y, visitablePos().z);
return;
}
auto terrain = tile->getTerrainID();
//FIXME: not the best way to do this
auto app = getObjectHandler()->getOverride(terrain, this);
if (app)