diff options
author | kaelima <kaelima@live.se> | 2012-10-30 22:29:52 +0100 |
---|---|---|
committer | kaelima <kaelima@live.se> | 2012-10-30 22:30:24 +0100 |
commit | 9d81c763fee423f824b95d6c39d09a87570c4ddf (patch) | |
tree | d7d087ec5e87eb75745cb40007cec7a8a3238579 /src | |
parent | cd8e9dfb5213f6e299065cc1f87535a26c2f2936 (diff) |
Core/Player: Fix crash in Player::CanUseBattlegroundObject when called from certain spells
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d409b507561..80f2ecb47b4 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23507,11 +23507,15 @@ WorldObject* Player::GetViewpoint() const bool Player::CanUseBattlegroundObject(GameObject* gameobject) { - FactionTemplateEntry const* playerFaction = getFactionTemplateEntry(); - FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(gameobject->GetUInt32Value(GAMEOBJECT_FACTION)); + // It is possible to call this method will a null pointer, only skipping faction check. + if (gameobject) + { + FactionTemplateEntry const* playerFaction = getFactionTemplateEntry(); + FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(gameobject->GetUInt32Value(GAMEOBJECT_FACTION)); - if (playerFaction && faction && !playerFaction->IsFriendlyTo(*faction)) - return false; + if (playerFaction && faction && !playerFaction->IsFriendlyTo(*faction)) + return false; + } // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet // Note: Mount, stealth and invisibility will be removed when used |