Преглед на файлове

Merge pull request #5948 from Opuszek/fix_segmentation_fault

Fixes segmentation fault when getting magic strength of a hero
Ivan Savenko преди 5 месеца
родител
ревизия
76aa075d10
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      AI/Nullkiller/Analyzers/HeroManager.cpp

+ 4 - 0
AI/Nullkiller/Analyzers/HeroManager.cpp

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