Add null checks to potion removal and expiry event handlers, fixes #166

This commit is contained in:
Electroblob77
2019-08-18 20:17:12 +01:00
parent f86ea2334d
commit 831f68d8d9
@@ -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){