Browse Source

Fixes segmentation fault when getting magic strength of a hero

Opuszek 3 tháng trước cách đây
mục cha
commit
500fb3c134
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  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);