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

Merge pull request #2359 from IvanSavenko/crashfixing

Fix crashes from 1.2.1 statistics on Google Play
This commit is contained in:
Ivan Savenko
2023-07-21 15:44:37 +03:00
committed by GitHub
28 changed files with 413 additions and 511 deletions

View File

@ -1474,6 +1474,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());
@ -1491,6 +1492,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();