From be8a2a4b079f406ada7b5b7f294e7f4dcf333de3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Apr 2019 18:49:18 -0700 Subject: [PATCH] Fixes #3902 - NPE in Inventory Listener --- Changelog.txt | 1 + .../java/com/gmail/nossr50/listeners/InventoryListener.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 264203abe..38414333e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Version 2.1.49 Fixed a bug where falling blocks were not marked as unnatural in water Fixed a bug where Ability cooldowns were being called async when they are sync only + Fixed NPE when checking inventory location Version 2.1.48 1.14 Support diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index fb080fa32..5ba6c2d39 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -397,8 +397,10 @@ public class InventoryListener implements Listener { @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) { /* WORLD BLACKLIST CHECK */ - if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld())) - return; + + if(event.getSource().getLocation() != null) + if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld())) + return; Inventory inventory = event.getDestination();