From 22870c4764356f8c3cec960558d3605bc36285f0 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 10 Jul 2024 14:34:05 +0000 Subject: [PATCH] Fix potential crash on right-clicking object that gives secondary skills such as Witch Hut when town is selected --- lib/rewardable/Reward.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rewardable/Reward.cpp b/lib/rewardable/Reward.cpp index e5171e40b..0bdd5fb5d 100644 --- a/lib/rewardable/Reward.cpp +++ b/lib/rewardable/Reward.cpp @@ -106,7 +106,7 @@ void Rewardable::Reward::loadComponents(std::vector & comps, const CG { auto skillID = entry.first; int levelsGained = entry.second; - int currentLevel = h->getSecSkillLevel(skillID); + int currentLevel = h ? h->getSecSkillLevel(skillID) : 0; int finalLevel = std::min(static_cast(MasteryLevel::EXPERT), currentLevel + levelsGained); comps.emplace_back(ComponentType::SEC_SKILL, entry.first, finalLevel); }