1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added workaround for crashes with outdated mods

This commit is contained in:
Ivan Savenko 2023-12-09 18:08:22 +02:00
parent 6917e33ec3
commit df78c9c6f1
2 changed files with 7 additions and 1 deletions

View File

@ -133,7 +133,7 @@ void CHeroInstanceConstructor::afterLoadFinalization()
{
filters[entry.first] = LogicalExpression<HeroTypeID>(entry.second, [](const JsonNode & node)
{
return HeroTypeID(VLC->identifiers()->getIdentifier("hero", node.Vector()[0]).value());
return HeroTypeID(VLC->identifiers()->getIdentifier("hero", node.Vector()[0]).value_or(-1));
});
}
}

View File

@ -42,6 +42,12 @@ void Summon::adjustTargetTypes(std::vector<TargetType> & types) const
bool Summon::applicable(Problem & problem, const Mechanics * m) const
{
if (creature == CreatureID::NONE)
{
logMod->error("Attempt to summon non-existing creature!");
return m->adaptGenericProblem(problem);
}
if(exclusive)
{
//check if there are summoned creatures of other type