Explorar o código

Fix potential crash on right-clicking object that gives secondary skills
such as Witch Hut when town is selected

Ivan Savenko hai 1 ano
pai
achega
22870c4764
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      lib/rewardable/Reward.cpp

+ 1 - 1
lib/rewardable/Reward.cpp

@@ -106,7 +106,7 @@ void Rewardable::Reward::loadComponents(std::vector<Component> & comps, const CG
 	{
 	{
 		auto skillID = entry.first;
 		auto skillID = entry.first;
 		int levelsGained = entry.second;
 		int levelsGained = entry.second;
-		int currentLevel = h->getSecSkillLevel(skillID);
+		int currentLevel = h ? h->getSecSkillLevel(skillID) : 0;
 		int finalLevel = std::min(static_cast<int>(MasteryLevel::EXPERT), currentLevel + levelsGained);
 		int finalLevel = std::min(static_cast<int>(MasteryLevel::EXPERT), currentLevel + levelsGained);
 		comps.emplace_back(ComponentType::SEC_SKILL, entry.first, finalLevel);
 		comps.emplace_back(ComponentType::SEC_SKILL, entry.first, finalLevel);
 	}
 	}