From e3ae188ed284c029b8f32c941d840161c041e1fa Mon Sep 17 00:00:00 2001 From: V10lator Date: Sat, 18 Aug 2012 14:50:09 +0200 Subject: [PATCH] Fix instances where Signs have null lines. Addresses BUKKIT-684 --- src/main/java/net/minecraft/server/NetServerHandler.java | 3 +++ src/main/java/org/bukkit/craftbukkit/block/CraftSign.java | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index a5b280d449..dbd1a5dede 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -1302,6 +1302,9 @@ public class NetServerHandler extends NetHandler { if (!event.isCancelled()) { for (int l = 0; l < 4; ++l) { tileentitysign1.lines[l] = event.getLine(l); + if(tileentitysign1.lines[l] == null) { + tileentitysign1.lines[l] = ""; + } } tileentitysign1.isEditable = false; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java index ae54e0f492..8e8a1c5825 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -35,7 +35,13 @@ public class CraftSign extends CraftBlockState implements Sign { boolean result = super.update(force); if (result) { - System.arraycopy(lines, 0, sign.lines, 0, lines.length); + for(int i = 0; i < 4; i++) { + if(lines[i] != null) { + sign.lines[i] = lines[i]; + } else { + sign.lines[i] = ""; + } + } sign.update(); }