From eeacf49f215bc8dc6a7a43302ca42670c9e423b6 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:26:17 +0100 Subject: [PATCH] Fix an NPE in the isOutlawInTown method (#7736) --- .../java/com/palmergames/bukkit/towny/utils/CombatUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Towny/src/main/java/com/palmergames/bukkit/towny/utils/CombatUtil.java b/Towny/src/main/java/com/palmergames/bukkit/towny/utils/CombatUtil.java index f9f942cc12..988ebc8445 100644 --- a/Towny/src/main/java/com/palmergames/bukkit/towny/utils/CombatUtil.java +++ b/Towny/src/main/java/com/palmergames/bukkit/towny/utils/CombatUtil.java @@ -437,6 +437,9 @@ public static boolean isArenaPlot(TownBlock attackerTB, TownBlock defenderTB) { * @return true if one of the players is an outlaw in a situation where that matters. */ private static boolean isOutlawInTown(TownBlock defenderTB, Player attackingPlayer, Player defendingPlayer) { + if (defenderTB == null) + return false; + Town town = defenderTB.getTownOrNull(); if (town == null) return false;