diff options
| author | click <click@gonnamakeyou.com> | 2012-04-01 19:54:33 +0200 |
|---|---|---|
| committer | click <click@gonnamakeyou.com> | 2012-04-01 19:54:33 +0200 |
| commit | ad569ce649b500ee74d7616acedefc74b6d0cd6b (patch) | |
| tree | d550ef21c0ce26a4f56a17429c1aaddb7e86bc9a | |
| parent | 4e58efcfec2e6e5d75d8be4b3319acf00b64cd65 (diff) | |
Core: Only clear motionmaster flags if the respective entity exists in world.
Original patch by kewarr and Mrsmite, additional commenting by Machiavelli removing the pet-specific checks applied.
Fixes #5400.
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 12 |
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 |
