From a2fc9c94fd17960ff74693d96f7d76fc99cb59be Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 1 Aug 2014 20:02:50 -0700 Subject: [PATCH] Fix NPE when a manager fails to load. --- .../protection/GlobalRegionManager.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java b/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java index 213c10c3..dd23de6a 100644 --- a/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java +++ b/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java @@ -19,19 +19,6 @@ package com.sk89q.worldguard.protection; -import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; - -import java.io.File; -import java.io.FileNotFoundException; -import java.util.HashMap; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; - import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.bukkit.BukkitUtil; import com.sk89q.worldguard.bukkit.ConfigurationManager; @@ -44,6 +31,18 @@ import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.managers.PRTreeRegionManager; import com.sk89q.worldguard.protection.managers.RegionManager; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; + +import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; /** * This class keeps track of region information for every world. It loads @@ -129,7 +128,9 @@ public void unloadAll() { public RegionManager load(World world) { RegionManager manager = create(world); - managers.put(world.getName(), manager); + if (manager != null) { + managers.put(world.getName(), manager); + } return manager; }