From f76ec6fe2d24aecc3e4746c2de545d9266ce4619 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 20 Aug 2016 12:41:27 +0200 Subject: [PATCH] Added null check for shop item when updating visibility --- .../de/epiceric/shopchest/listeners/ShopItemListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopItemListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopItemListener.java index f0136a9..4520ccc 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopItemListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopItemListener.java @@ -83,10 +83,12 @@ public class ShopItemListener implements Listener { for (Shop shop : shopUtils.getShops()) { Location shopLocation = shop.getLocation(); if (w.equals(shopLocation.getWorld()) && shopLocation.distanceSquared(playerLocation) <= itemDistanceSquared) { - if (reset) shop.getItem().resetForPlayer(p); - else shop.getItem().setVisible(p, true); + if (shop.getItem() != null) { + if (reset) shop.getItem().resetForPlayer(p); + else shop.getItem().setVisible(p, true); + } } else if (hideIfAway) { - shop.getItem().setVisible(p, false); + if (shop.getItem() != null) shop.getItem().setVisible(p, false); } } }