From b9c8fed01f4c2576a046967307544e55e946ad59 Mon Sep 17 00:00:00 2001 From: bm01 Date: Fri, 27 Apr 2012 08:17:02 +0200 Subject: [PATCH] Made Party.isInParty safer --- src/main/java/com/gmail/nossr50/party/Party.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/party/Party.java b/src/main/java/com/gmail/nossr50/party/Party.java index bd33c0d97..f1ed739ad 100644 --- a/src/main/java/com/gmail/nossr50/party/Party.java +++ b/src/main/java/com/gmail/nossr50/party/Party.java @@ -12,6 +12,8 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; + import org.bukkit.entity.Player; import com.gmail.nossr50.Users; @@ -542,7 +544,14 @@ public class Party { * @return true if this player is in the right party, false otherwise */ public boolean isInParty(Player player, PlayerProfile PP) { - return partyPlayers.get(PP.getParty()).containsKey(player.getName()); + Map party = partyPlayers.get(PP.getParty()); + + if (party != null && party.containsKey(player.getName())) { + return true; + } + else { + return false; + } } /**