aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <none@none>2009-12-25 19:44:15 +0100
committerMachiavelli <none@none>2009-12-25 19:44:15 +0100
commitcb2cb590e365ad5dca8820017a8ef6d7b157a016 (patch)
tree28ee75b6707970596c6500f17436817a82effd6b
parentf75c0f8081336f010d98332cb017ef6a3dd9225e (diff)
Fix a crash in BattleGroundMgr::BuildPvpLogDataPacket caused by objmgr not finding player object by guid when showing scoreboard. In this case get bg team ID for player via character database. Closes #938
--HG-- branch : trunk
-rw-r--r--src/game/BattleGroundMgr.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 1259f26b0da..04cd3e03273 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -1336,8 +1336,22 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
*data << uint32(itr->second->KillingBlows);
if (type) // if (bg->isArena())
{
+ // BG Team ID (Green/Gold team, not faction teams in arena)
Player *plr = objmgr.GetPlayer(itr->first);
- *data << uint8(plr->GetBGTeam()); // BG Team ID (Green/Gold team, not faction teams in arena)
+ uint8 team = 0;
+ if (plr)
+ team = plr->GetBGTeam();
+ else
+ {
+ QueryResult *result = CharacterDatabase.PQuery("SELECT team FROM character_battleground_data WHERE guid = '%u'", GUID_LOPART(itr->first));
+ if (result)
+ {
+ team = (*result)[0].GetUInt8();
+ delete result;
+ }
+ else
+ sLog.outError("Player GUID %u - unable to find correct BG Team ID for MSG_PVP_LOG_DATA (scoreboard). Defaulting to 0.", GUID_LOPART(itr->first));
+ }
}
else // if (!bg->isArena())
{