From 0723e0e365b4ab4ea37756c99017ac596dcd0a9f Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 19 Jan 2022 22:43:53 +0000 Subject: [PATCH] Fixed addDamageHate method NPE. --- .../org/l2jmobius/gameserver/model/actor/Attackable.java | 9 +++++---- .../org/l2jmobius/gameserver/model/actor/Attackable.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Attackable.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Attackable.java index ecdf3837c6..ec025ffaec 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Attackable.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Attackable.java @@ -963,17 +963,18 @@ public class Attackable extends Npc ai._damage += damage; // Set the intention to the Attackable to AI_INTENTION_ACTIVE - if ((getAI() != null) && (aggro > 0) && (getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)) + final CreatureAI activeAI = getAI(); + if ((activeAI != null) && (aggro > 0) && (activeAI.getIntention() == CtrlIntention.AI_INTENTION_IDLE)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + activeAI.setIntention(CtrlIntention.AI_INTENTION_ACTIVE); } // Notify the Attackable AI with EVT_ATTACKED if (damage > 0) { - if (getAI() != null) + if (activeAI != null) { - getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, attacker); + activeAI.notifyEvent(CtrlEvent.EVT_ATTACKED, attacker); } try diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java index 59716d66b2..a3b797bf95 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Attackable.java @@ -964,17 +964,18 @@ public class Attackable extends Npc ai._damage += damage; // Set the intention to the Attackable to AI_INTENTION_ACTIVE - if ((getAI() != null) && (aggro > 0) && (getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)) + final CreatureAI activeAI = getAI(); + if ((activeAI != null) && (aggro > 0) && (activeAI.getIntention() == CtrlIntention.AI_INTENTION_IDLE)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + activeAI.setIntention(CtrlIntention.AI_INTENTION_ACTIVE); } // Notify the Attackable AI with EVT_ATTACKED if (damage > 0) { - if (getAI() != null) + if (activeAI != null) { - getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, attacker); + activeAI.notifyEvent(CtrlEvent.EVT_ATTACKED, attacker); } try