1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Fixes segmentation fault when getting magic strength of a hero

This commit is contained in:
Opuszek
2025-07-25 00:24:55 +02:00
parent 25ba05cdab
commit 500fb3c134

View File

@@ -221,6 +221,10 @@ float HeroManager::getMagicStrength(const CGHeroInstance * hero) const
for(auto spellId : hero->getSpellsInSpellbook())
{
auto spell = spellId.toSpell();
if (!spell->isAdventure())
continue;
auto schoolLevel = hero->getSpellSchoolLevel(spell);
auto townPortalEffect = spell->getAdventureMechanics().getEffectAs<TownPortalEffect>(hero);