From c248d419bb942dac9260e555b8d5267d19914f30 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sat, 28 Jan 2012 17:15:20 +0100 Subject: [PATCH] Panic fix to remove infinite loop --- src/com/massivecraft/factions/FPlayer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index 746ebd56..b13ff483 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -133,9 +133,14 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator public final void resetFactionData(boolean doSpotUpdate) { - Faction currentFaction = this.getFaction(); - if (currentFaction != null) - currentFaction.removeFPlayer(this); + if (this.factionId != null && Factions.i.exists(this.factionId)) // Avoid infinite loop! TODO: I think that this is needed is a sign we need to refactor. + { + Faction currentFaction = this.getFaction(); + if (currentFaction != null) + { + currentFaction.removeFPlayer(this); + } + } this.factionId = "0"; // The default neutral faction this.chatMode = ChatMode.PUBLIC;