From f08143fc8d696e409e8ebe9dfa7197082fd77b4b Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 23 Jul 2021 23:07:06 +0000 Subject: [PATCH] Fixed probable homunculus slot NPE. --- .../homunculus/RequestExHomunculusEnchantExp.java | 6 ++++++ .../homunculus/RequestExHomunculusEnchantExp.java | 6 ++++++ .../homunculus/RequestExHomunculusEnchantExp.java | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java index 4d014a44db..a69562da95 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java @@ -59,6 +59,12 @@ public class RequestExHomunculusEnchantExp implements IClientIncomingPacket int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) - 1; player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points); final Homunculus homunculus = player.getHomunculusList().get(_slot); + if (homunculus == null) + { + player.sendPacket(new ExHomunculusEnchantEXPResult(false, false)); + return; + } + homunculus.setExp(homunculus.getExp() + EXP_PER_POINT); player.sendPacket(new ExHomunculusPointInfo(player)); switch (homunculus.getLevel()) diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java index 4d014a44db..a69562da95 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java @@ -59,6 +59,12 @@ public class RequestExHomunculusEnchantExp implements IClientIncomingPacket int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) - 1; player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points); final Homunculus homunculus = player.getHomunculusList().get(_slot); + if (homunculus == null) + { + player.sendPacket(new ExHomunculusEnchantEXPResult(false, false)); + return; + } + homunculus.setExp(homunculus.getExp() + EXP_PER_POINT); player.sendPacket(new ExHomunculusPointInfo(player)); switch (homunculus.getLevel()) diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java index 4d014a44db..a69562da95 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/network/clientpackets/homunculus/RequestExHomunculusEnchantExp.java @@ -59,6 +59,12 @@ public class RequestExHomunculusEnchantExp implements IClientIncomingPacket int points = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, 0) - 1; player.getVariables().set(PlayerVariables.HOMUNCULUS_UPGRADE_POINTS, points); final Homunculus homunculus = player.getHomunculusList().get(_slot); + if (homunculus == null) + { + player.sendPacket(new ExHomunculusEnchantEXPResult(false, false)); + return; + } + homunculus.setExp(homunculus.getExp() + EXP_PER_POINT); player.sendPacket(new ExHomunculusPointInfo(player)); switch (homunculus.getLevel())