aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp12
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