aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/common
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2024-07-27 20:41:18 +0100
committerGitHub <noreply@github.com>2024-07-27 20:41:18 +0100
commitfab71ba2fece1f018b10eac7aa0de1aeb22b2ecf (patch)
treee6598740ad546267e634da52669dde9d8ba17a56 /src/main/java/gtPlusPlus/core/common
parentc7b38c23c5b34a324256966f0a9335694fe8d63b (diff)
downloadGT5-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.java13
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);
}
}