*Don't increment an iterator after it's erased, by RammboNr5. Also remove an unused iterator.

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-31 00:50:27 -07:00
parent 664503fea0
commit e45eeecdcd
+2 -2
View File
@@ -21964,7 +21964,7 @@ void Player::_SaveTalents()
{ {
for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i) for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
{ {
for (PlayerTalentMap::iterator itr = m_talents[i]->begin(), next = m_talents[i]->begin(); itr != m_talents[i]->end(); ) for (PlayerTalentMap::iterator itr = m_talents[i]->begin(); itr != m_talents[i]->end(); )
{ {
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED)
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE guid = '%u' and spell = '%u' and spec = '%u'", GetGUIDLow(), itr->first, itr->second->spec); CharacterDatabase.PExecute("DELETE FROM character_talent WHERE guid = '%u' and spell = '%u' and spec = '%u'", GetGUIDLow(), itr->first, itr->second->spec);
@@ -21975,7 +21975,7 @@ void Player::_SaveTalents()
if (itr->second->state == PLAYERSPELL_REMOVED) if (itr->second->state == PLAYERSPELL_REMOVED)
{ {
delete itr->second; delete itr->second;
m_talents[i]->erase(itr++); m_talents[i]->erase(itr);
} }
else else
{ {