mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
fix(ElunaLuaEngine): Add nullptr checks to OnDamage and OnHeal methods (#320)
This commit is contained in:
@@ -1219,6 +1219,9 @@ public:
|
|||||||
|
|
||||||
void OnHeal(Unit* healer, Unit* receiver, uint32& gain) override
|
void OnHeal(Unit* healer, Unit* receiver, uint32& gain) override
|
||||||
{
|
{
|
||||||
|
if (!receiver) return;
|
||||||
|
if (!healer) return;
|
||||||
|
|
||||||
if (healer->IsPlayer())
|
if (healer->IsPlayer())
|
||||||
sEluna->OnPlayerHeal(healer->ToPlayer(), receiver, gain);
|
sEluna->OnPlayerHeal(healer->ToPlayer(), receiver, gain);
|
||||||
|
|
||||||
@@ -1228,6 +1231,9 @@ public:
|
|||||||
|
|
||||||
void OnDamage(Unit* attacker, Unit* receiver, uint32& damage) override
|
void OnDamage(Unit* attacker, Unit* receiver, uint32& damage) override
|
||||||
{
|
{
|
||||||
|
if (!receiver) return;
|
||||||
|
if (!attacker) return;
|
||||||
|
|
||||||
if (attacker->IsPlayer())
|
if (attacker->IsPlayer())
|
||||||
sEluna->OnPlayerDamage(attacker->ToPlayer(), receiver, damage);
|
sEluna->OnPlayerDamage(attacker->ToPlayer(), receiver, damage);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user