1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Attempt to fix / trace crashes from Google Play statistics

This commit is contained in:
Ivan Savenko
2023-07-17 22:19:25 +03:00
parent c7d88271a9
commit 5e8a778e7d
4 changed files with 31 additions and 8 deletions

View File

@ -1479,6 +1479,7 @@ void NewObject::applyGs(CGameState *gs)
terrainType = t.terType->getId();
auto handler = VLC->objtypeh->getHandlerFor(ID, subID);
CGObjectInstance * o = handler->create();
handler->configureObject(o, gs->getRandomGenerator());
@ -1496,6 +1497,11 @@ void NewObject::applyGs(CGameState *gs)
}
assert(!handler->getTemplates(terrainType).empty());
if (handler->getTemplates().empty())
{
logGlobal->error("Attempt to create object (%d %d) with no templates!", ID, subID);
return;
}
if (!handler->getTemplates(terrainType).empty())
o->appearance = handler->getTemplates(terrainType).front();