2015-03-08 11:04:41 +00:00
From 3a5a748f61e6319b40762319333d5fdde3d9ef1c Mon Sep 17 00:00:00 2001
2014-07-21 20:46:54 +00:00
From: md_5 <md_5@live.com.au>
Date: Mon, 18 Mar 2013 20:01:44 +1100
Subject: [PATCH] Prevent NPE in CraftSign
This commit prevents the constructor of CraftSign throwing an NPE when it cannot get the sign tile entity. Instead it will fallback to a 4 empty lined sign, and not try to do anything to those lines on .update().
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
2014-11-28 01:17:45 +00:00
index 724dbd1..1b603b2 100644
2014-07-21 20:46:54 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
2014-11-28 01:17:45 +00:00
@@ -17,6 +17,12 @@ public class CraftSign extends CraftBlockState implements Sign {
2014-07-21 20:46:54 +00:00
CraftWorld world = (CraftWorld) block.getWorld();
sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
+ // Spigot start
+ if (sign == null) {
+ lines = new String[]{"", "", "", ""};
+ return;
+ }
+ // Spigot end
lines = new String[sign.lines.length];
2014-11-28 01:17:45 +00:00
System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
2014-07-21 20:46:54 +00:00
}
--
2014-11-28 01:17:45 +00:00
2.1.0
2014-07-21 20:46:54 +00:00