From 28eddfcc38d0d8392987abecf74ab189a0e92b47 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 20 Apr 2014 11:17:14 +1000 Subject: [PATCH] Log null TileEntity Owner. Should prevent a crash and provide some info on the location. --- .../0138-Log-null-TileEntity-Owner.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 CraftBukkit-Patches/0138-Log-null-TileEntity-Owner.patch diff --git a/CraftBukkit-Patches/0138-Log-null-TileEntity-Owner.patch b/CraftBukkit-Patches/0138-Log-null-TileEntity-Owner.patch new file mode 100644 index 0000000000..b95974a5f3 --- /dev/null +++ b/CraftBukkit-Patches/0138-Log-null-TileEntity-Owner.patch @@ -0,0 +1,29 @@ +From 336e47f7667c88b93d2270fc264bd0cfffe1b307 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sun, 20 Apr 2014 11:16:54 +1000 +Subject: [PATCH] Log null TileEntity Owner + + +diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java +index 78e17d7..19d008c 100644 +--- a/src/main/java/net/minecraft/server/TileEntity.java ++++ b/src/main/java/net/minecraft/server/TileEntity.java +@@ -177,7 +177,14 @@ public class TileEntity { + + // CraftBukkit start - add method + public InventoryHolder getOwner() { +- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(x, y, z).getState(); ++ // Spigot start ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(x, y, z); ++ if (block == null) { ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), x, y, z}); ++ return null; ++ } ++ // Spigot end ++ org.bukkit.block.BlockState state = block.getState(); + if (state instanceof InventoryHolder) return (InventoryHolder) state; + return null; + } +-- +1.9.1 +