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:
@ -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();
|
||||
|
Reference in New Issue
Block a user