From 831f68d8d98092f917ece9cfb55c7896952f7b21 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Sun, 18 Aug 2019 20:17:12 +0100 Subject: [PATCH] Add null checks to potion removal and expiry event handlers, fixes #166 --- src/main/java/electroblob/wizardry/potion/ISyncedPotion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/electroblob/wizardry/potion/ISyncedPotion.java b/src/main/java/electroblob/wizardry/potion/ISyncedPotion.java index 76741001..98e4fcab 100644 --- a/src/main/java/electroblob/wizardry/potion/ISyncedPotion.java +++ b/src/main/java/electroblob/wizardry/potion/ISyncedPotion.java @@ -52,7 +52,7 @@ public interface ISyncedPotion { @SubscribeEvent public static void onPotionExpiryEvent(PotionEvent.PotionExpiryEvent event){ - if(event.getPotionEffect().getPotion() instanceof ISyncedPotion + if(event.getPotionEffect() != null && event.getPotionEffect().getPotion() instanceof ISyncedPotion && ((ISyncedPotion)event.getPotionEffect().getPotion()).shouldSync(event.getEntityLiving())){ if(!event.getEntityLiving().world.isRemote){ @@ -67,7 +67,7 @@ public interface ISyncedPotion { @SubscribeEvent public static void onPotionRemoveEvent(PotionEvent.PotionRemoveEvent event){ - if(event.getPotionEffect().getPotion() instanceof ISyncedPotion + if(event.getPotionEffect() != null && event.getPotionEffect().getPotion() instanceof ISyncedPotion && ((ISyncedPotion)event.getPotionEffect().getPotion()).shouldSync(event.getEntityLiving())){ if(!event.getEntityLiving().world.isRemote){