Paper/Spigot-Server-Patches/0200-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch
Aikar e4d10a6d67
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches
a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType()

CraftBukkit Changes:
bbe3d58e SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException
3075579f Add FaceAttachable interface to handle Grindstone facing in common with Switches
95bd4238 SPIGOT-5647: ZombieVillager entity should have getVillagerType()
4d975ac3 SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
2020-04-02 17:09:17 -04:00

32 lines
1.3 KiB
Diff

From d48f8ffe7c980bd2e8c646dfb2c21669f20b2438 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 10 Mar 2018 13:03:49 +0000
Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened
by plugins
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index 5a9ac3960d..fd31b9a6dc 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -5,7 +5,7 @@ import org.bukkit.inventory.InventoryHolder;
public class InventoryEnderChest extends InventorySubcontainer {
- private TileEntityEnderChest a;
+ private TileEntityEnderChest a; public TileEntityEnderChest getTileEntity() { return a; } // Paper - OBFHELPER
// CraftBukkit start
private final EntityHuman owner;
@@ -15,6 +15,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
@Override
public Location getLocation() {
+ if (getTileEntity() == null) return null; // Paper - return null if there is no TE bound (opened by plugin)
return new Location(this.a.getWorld().getWorld(), this.a.getPosition().getX(), this.a.getPosition().getY(), this.a.getPosition().getZ());
}
--
2.25.1