Skip to content

Instantly share code, notes, and snippets.

@higi
Created October 10, 2012 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save higi/3862491 to your computer and use it in GitHub Desktop.
Save higi/3862491 to your computer and use it in GitHub Desktop.
with thx to huri
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 99cf1cd..10315aa 100755
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -400,6 +400,9 @@ Unit* PetAI::SelectNextTarget()
void PetAI::HandleReturnMovement()
{
+ if (!me->GetCharmInfo())
+ return;
+
// Handles moving the pet back to stay or owner
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
@@ -503,6 +506,9 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
bool PetAI::CanAttack(Unit* target)
{
+ if (!me->GetCharmInfo())
+ return false;
+
// Evaluates wether a pet can attack a specific
// target based on CommandState, ReactState and other flags
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 34c5732..9d05c3a 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -5524,7 +5524,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId());
// Such zones are considered unreachable as a ghost and the player must be automatically revived
- if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < zone->MaxDepth)
+ if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || (zone && GetPositionZ() < zone->MaxDepth))
{
ResurrectPlayer(0.5f);
SpawnCorpseBones();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment