From 662dbb85ed371e88fbefa635a992d370d540b649 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 6 Oct 2014 13:24:52 +0200 Subject: [PATCH] Strange NPE evade. Fixes #534, #387, #692 --- .../factions/listeners/FactionsListenerMain.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java index aa324500..45f717fb 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -665,8 +665,14 @@ public class FactionsListenerMain implements Listener if (reason != SpawnReason.NATURAL && reason != SpawnReason.JOCKEY) return; // ... and monsters are forbidden at the location ... - PS ps = PS.valueOf(event.getLocation()); + Location location = event.getLocation(); + if (location == null) return; + + PS ps = PS.valueOf(location); + Faction faction = BoardColl.get().getFactionAt(ps); + if (faction == null) return; + if (faction.getFlag(MFlag.getMonsters())) return; // ... block the spawn.