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

Merge pull request #5948 from Opuszek/fix_segmentation_fault

Fixes segmentation fault when getting magic strength of a hero
This commit is contained in:
Ivan Savenko
2025-07-28 18:51:52 +03:00
committed by GitHub

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);