diff options
author | Raven Szewczyk <git@eigenraven.me> | 2024-07-27 20:41:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-27 20:41:18 +0100 |
commit | fab71ba2fece1f018b10eac7aa0de1aeb22b2ecf (patch) | |
tree | e6598740ad546267e634da52669dde9d8ba17a56 /src/main/java/gtPlusPlus/core/common | |
parent | c7b38c23c5b34a324256966f0a9335694fe8d63b (diff) | |
download | GT5-Unofficial-fab71ba2fece1f018b10eac7aa0de1aeb22b2ecf.tar.gz GT5-Unofficial-fab71ba2fece1f018b10eac7aa0de1aeb22b2ecf.tar.bz2 GT5-Unofficial-fab71ba2fece1f018b10eac7aa0de1aeb22b2ecf.zip |
Fix NPE in the moved bauble event handler (#2775)
Diffstat (limited to 'src/main/java/gtPlusPlus/core/common')
-rw-r--r-- | src/main/java/gtPlusPlus/core/common/CommonProxy.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index 12f0971e73..90b4c99ed8 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -227,15 +227,20 @@ public class CommonProxy { return; } InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); + if (baubles == null) { + return; + } final ItemStack bauble1 = baubles.getStackInSlot(1); - if (bauble1.getItem() instanceof BaseBauble gtBauble && gtBauble.getDamageNegations() - .contains(event.source.damageType)) { + if (bauble1 != null && bauble1.getItem() instanceof BaseBauble gtBauble + && gtBauble.getDamageNegations() + .contains(event.source.damageType)) { event.setCanceled(true); return; } final ItemStack bauble2 = baubles.getStackInSlot(2); - if (bauble2.getItem() instanceof BaseBauble gtBauble && gtBauble.getDamageNegations() - .contains(event.source.damageType)) { + if (bauble2 != null && bauble2.getItem() instanceof BaseBauble gtBauble + && gtBauble.getDamageNegations() + .contains(event.source.damageType)) { event.setCanceled(true); } } |