From 7da0b9877f8c2cefc57f4d2eda828af55fa5c1a0 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 26 Jun 2016 17:07:46 +1000 Subject: [PATCH] Fixes #1221 (the NPE at least) --- .../bukkit/util/block/BukkitLocalQueue.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue.java index 4d1086956..c655f40ec 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue.java @@ -82,20 +82,22 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue { if (blocksLayer != null) { for (int j = 0; j < blocksLayer.length; j++) { PlotBlock block = blocksLayer[j]; - int x = MainUtil.x_loc[layer][j]; - int y = MainUtil.y_loc[layer][j]; - int z = MainUtil.y_loc[layer][j]; - Block existing = chunk.getBlock(x, y, z); - int existingId = existing.getTypeId(); - if (existingId == block.id) { - if (existingId == 0) { - continue; - } - if (existing.getData() == block.data) { - continue; + if (block != null) { + int x = MainUtil.x_loc[layer][j]; + int y = MainUtil.y_loc[layer][j]; + int z = MainUtil.y_loc[layer][j]; + Block existing = chunk.getBlock(x, y, z); + int existingId = existing.getTypeId(); + if (existingId == block.id) { + if (existingId == 0) { + continue; + } + if (existing.getData() == block.data) { + continue; + } } + existing.setTypeIdAndData(block.id, block.data, false); } - existing.setTypeIdAndData(block.id, block.data, false); } } }