浏览代码

Fixes #3902 - NPE in Inventory Listener

nossr50 6 年之前
父节点
当前提交
be8a2a4b07
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 1 0
      Changelog.txt
  2. 4 2
      src/main/java/com/gmail/nossr50/listeners/InventoryListener.java

+ 1 - 0
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

+ 4 - 2
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();