*Attempt to fix a crash, and sanitize some input.

--HG--
branch : trunk
This commit is contained in:
maximius
2009-09-28 15:48:03 -07:00
parent daa9b62ec7
commit 0a9addd224
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -244,7 +244,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
uint32 account_id = m_session->GetAccountId();
int lev=atoi(szExp); //get int anyway (0 if error)
if(lev < 0)
if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION))
return false;
// No SQL injection
+1 -1
View File
@@ -6998,7 +6998,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args)
return false;
int lev=atoi(szExp); //get int anyway (0 if error)
if(lev < 0)
if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION))
return false;
// No SQL injection
+2 -2
View File
@@ -11356,9 +11356,9 @@ Unit* Creature::SelectVictim()
// Note: creature not have targeted movement generator but have attacker in this case
for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
{
if(canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
if((*itr) && canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
&& !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)
&& (!(*itr)->getVictim() || !(*itr)->isAttackingPlayer() || IsFriendlyTo(target->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly
&& (!(*itr)->getVictim() || !(*itr)->isAttackingPlayer() || IsFriendlyTo((*itr)->getVictim()))) // if the victim of target is a player, only defend the victim if we are friendly
return NULL;
}