From abfbff19fadb2be0c73d203f18ba0477e6e2215d Mon Sep 17 00:00:00 2001 From: PhanaticD Date: Sat, 12 Jan 2019 22:12:17 -0500 Subject: [PATCH] null check in tempblock revert_queue, rare occasion when server stops before any tempblocks are made --- .../projectkorra/util/TempBlock.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/com/projectkorra/projectkorra/util/TempBlock.java b/src/com/projectkorra/projectkorra/util/TempBlock.java index 318754cb..218feca4 100644 --- a/src/com/projectkorra/projectkorra/util/TempBlock.java +++ b/src/com/projectkorra/projectkorra/util/TempBlock.java @@ -1,10 +1,7 @@ package com.projectkorra.projectkorra.util; -import java.util.Comparator; -import java.util.Map; -import java.util.PriorityQueue; -import java.util.concurrent.ConcurrentHashMap; - +import com.projectkorra.projectkorra.GeneralMethods; +import com.projectkorra.projectkorra.ProjectKorra; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -14,8 +11,10 @@ import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Levelled; import org.bukkit.scheduler.BukkitRunnable; -import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ProjectKorra; +import java.util.Comparator; +import java.util.Map; +import java.util.PriorityQueue; +import java.util.concurrent.ConcurrentHashMap; public class TempBlock { @@ -88,8 +87,10 @@ public class TempBlock { for (final Block block : instances.keySet()) { revertBlock(block, Material.AIR); } - for (final TempBlock tempblock : REVERT_QUEUE) { - tempblock.revertBlock(); + if (REVERT_QUEUE != null) { + for (final TempBlock tempblock : REVERT_QUEUE) { + tempblock.revertBlock(); + } } }