aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-05-06 15:49:56 -0300
committerfunjoker <funjoker109@gmail.com>2020-06-14 23:49:04 +0200
commit43339e68402a428862198fdc0c8143ab749dc59e (patch)
tree0b49bdae056ce0069e14005e78b29025c9069a48
parent57e3a67c94c58e7a18b7b0c97f6756f4883de552 (diff)
Core/Players: fix null dereference crash
(cherry picked from commit c3176a814306db20a6f0ff7cdf1baad6bf9c877c)
-rw-r--r--src/server/game/Entities/Player/Player.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 713b2a860f9..939d7e750d1 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -25390,18 +25390,24 @@ void Player::ResurrectUsingRequestData()
void Player::ResurrectUsingRequestDataImpl()
{
+ // save health and mana before resurrecting, _resurrectionData can be erased
+ uint32 resurrectHealth = _resurrectionData->Health;
+ uint32 resurrectMana = _resurrectionData->Mana;
+ uint32 resurrectAura = _resurrectionData->Aura;
+ ObjectGuid resurrectGUID = _resurrectionData->GUID;
+
ResurrectPlayer(0.0f, false);
- SetHealth(_resurrectionData->Health);
- SetPower(POWER_MANA, _resurrectionData->Mana);
+ SetHealth(resurrectHealth);
+ SetPower(POWER_MANA, resurrectMana);
SetPower(POWER_RAGE, 0);
SetFullPower(POWER_ENERGY);
SetFullPower(POWER_FOCUS);
SetPower(POWER_LUNAR_POWER, 0);
- if (uint32 aura = _resurrectionData->Aura)
- CastSpell(this, aura, true, nullptr, nullptr, _resurrectionData->GUID);
+ if (uint32 aura = resurrectAura)
+ CastSpell(this, aura, true, nullptr, nullptr, resurrectGUID);
SpawnCorpseBones();
}