diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 56bf26d8..63080b2d 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -1229,19 +1229,19 @@ void InventoryComponent::AddItemSkills(const LOT lot) const auto index = m_Skills.find(slot); - if (index != m_Skills.end()) - { - const auto old = index->second; - - GameMessages::SendRemoveSkill(m_Parent, old); - } - const auto skill = FindSkill(lot); if (skill == 0) { return; } + + if (index != m_Skills.end()) + { + const auto old = index->second; + + GameMessages::SendRemoveSkill(m_Parent, old); + } GameMessages::SendAddSkill(m_Parent, skill, static_cast(slot));