aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrazom62 <none@none>2010-03-11 23:12:44 +0100
committerTrazom62 <none@none>2010-03-11 23:12:44 +0100
commit8947cfd41c77406a4d8ab81841f77d8efff2ccc1 (patch)
treee8c2e3dce392ebf2afdcaf10f79af6aa0fe2bea7
parented8c5ef6ffdbeadb600990fe683f5e20e8f31759 (diff)
Fix crash in getFactionTemplateEntry.
Fixe issues #1050. --HG-- branch : trunk
-rw-r--r--src/game/Unit.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index cd175627a02..162166e5bf6 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8633,10 +8633,13 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
if(GetGUID() != guid)
{
- if(GetTypeId() == TYPEID_PLAYER)
- sLog.outError("Player %s have invalid faction (faction template id) #%u", this->ToPlayer()->GetName(), getFaction());
- else
- sLog.outError("Creature (template id: %u) have invalid faction (faction template id) #%u", this->ToCreature()->GetCreatureInfo()->Entry, getFaction());
+ if (const Player *player = ToPlayer())
+ sLog.outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
+ else if (const Creature *creature = ToCreature())
+ sLog.outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureInfo()->Entry, getFaction());
+ else
+ sLog.outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction());
+
guid = GetGUID();
}
}