From 7879564d8806b08d8a054712c45ac0ad2d2bac6d Mon Sep 17 00:00:00 2001 From: iThorgrim <125808072+iThorgrim@users.noreply.github.com> Date: Tue, 30 Sep 2025 17:56:27 +0200 Subject: [PATCH] Fix UnitEvent (SegFault) (#321) --- src/ElunaLuaEngine_SC.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp index 9b45732..3f07636 100644 --- a/src/ElunaLuaEngine_SC.cpp +++ b/src/ElunaLuaEngine_SC.cpp @@ -1210,6 +1210,8 @@ public: void OnAuraApply(Unit* unit, Aura* aura) override { + if (!unit || !aura) return; + if (unit->IsPlayer()) sEluna->OnPlayerAuraApply(unit->ToPlayer(), aura); @@ -1219,9 +1221,8 @@ public: void OnHeal(Unit* healer, Unit* receiver, uint32& gain) override { - if (!receiver) return; - if (!healer) return; - + if (!receiver || !healer) return; + if (healer->IsPlayer()) sEluna->OnPlayerHeal(healer->ToPlayer(), receiver, gain); @@ -1231,8 +1232,7 @@ public: void OnDamage(Unit* attacker, Unit* receiver, uint32& damage) override { - if (!receiver) return; - if (!attacker) return; + if (!attacker || !receiver) return; if (attacker->IsPlayer()) sEluna->OnPlayerDamage(attacker->ToPlayer(), receiver, damage);