Skip to content

Commit

Permalink
Add safety check when removing a spell
Browse files Browse the repository at this point in the history
  • Loading branch information
Warlockbugs committed Nov 2, 2016
1 parent 16a97ba commit 718dad4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/game/Player.cpp
Expand Up @@ -3394,6 +3394,11 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo
for (SpellLearnSpellMap::const_iterator child_itr = spell_bounds.first; child_itr != spell_bounds.second; ++child_itr)
removeSpell(child_itr->second.spell, !IsPassiveSpell(child_itr->second.spell), learn_low_rank);

// search again just in case
itr = m_spells.find(spell_id);
if (itr == m_spells.end())
return;

PlayerSpell& playerSpell = itr->second;
if (playerSpell.state == PLAYERSPELL_REMOVED || (disabled && playerSpell.disabled))
return;
Expand Down

0 comments on commit 718dad4

Please sign in to comment.