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

Workaround to avoid crash on invalid bonus

This commit is contained in:
Ivan Savenko 2023-12-10 16:32:43 +02:00
parent ee7bd87b8d
commit a7c838036d

View File

@ -1088,7 +1088,10 @@ void BattleActionProcessor::attackCasting(const CBattleInfoCallback & battle, bo
TConstBonusListPtr spells = attacker->getBonuses(Selector::type()(attackMode)); TConstBonusListPtr spells = attacker->getBonuses(Selector::type()(attackMode));
for(const auto & sf : *spells) for(const auto & sf : *spells)
{ {
spellsToCast.insert(sf->subtype.as<SpellID>()); if (sf->subtype.as<SpellID>() != SpellID())
spellsToCast.insert(sf->subtype.as<SpellID>());
else
logMod->error("Invalid spell to cast during attack!");
} }
for(SpellID spellID : spellsToCast) for(SpellID spellID : spellsToCast)
{ {