aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 348335e1455..d71f8e8dfc3 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12776,8 +12776,16 @@ void Unit::setDeathState(DeathState s)
// remove aurastates allowing special moves
ClearAllReactives();
ClearDiminishings();
- GetMotionMaster()->Clear(false);
- GetMotionMaster()->MoveIdle();
+ if (IsInWorld())
+ {
+ // Only clear MotionMaster for entities that exists in world
+ // Avoids crashes in the following conditions :
+ // * Using 'call pet' on dead pets
+ // * Using 'call stabled pet'
+ // * Logging in with dead pets
+ GetMotionMaster()->Clear(false);
+ GetMotionMaster()->MoveIdle();
+ }
StopMoving();
DisableSpline();
// without this when removing IncreaseMaxHealth aura player may stuck with 1 hp