From 32e9de6e9ad2bc3002d5d0ae5c8d344f595bac71 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 27 Jun 2012 23:50:59 -0400 Subject: [PATCH] Fix for NPE on party checks due to CombatTag plugin. --- .../java/com/gmail/nossr50/party/PartyManager.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index 21abbeaa6..614306d67 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -41,8 +41,18 @@ public class PartyManager { * @return true if they are in the same party, false otherwise */ public boolean inSameParty(Player firstPlayer, Player secondPlayer) { - if (Users.getProfile(firstPlayer).getParty() == null || Users.getProfile(secondPlayer).getParty() == null - || !Users.getProfile(firstPlayer).getParty().equals(Users.getProfile(secondPlayer).getParty())) { + if (Users.getProfile(firstPlayer) == null) { + plugin.getLogger().info("The defending player's profile was null."); + plugin.getLogger().info("This player is online: " + firstPlayer.isOnline()); + return false; + } + + if (Users.getProfile(secondPlayer) == null) { + plugin.getLogger().info("The attacking player's profile was null."); + plugin.getLogger().info("This player is online: " + secondPlayer.isOnline()); + return false; + } + if (Users.getProfile(firstPlayer).getParty() == null || Users.getProfile(secondPlayer).getParty() == null || !Users.getProfile(firstPlayer).getParty().equals(Users.getProfile(secondPlayer).getParty())) { return false; }