Null check ALL the profiles.

We should probably find a more elegant way to do this, though.
This commit is contained in:
GJ
2012-07-10 14:02:48 -04:00
parent 07c66378c0
commit 686bcd5308
4 changed files with 37 additions and 4 deletions

View File

@ -41,8 +41,15 @@ public class PartyManager {
* @return true if they are in the same party, false otherwise
*/
public boolean inSameParty(Player firstPlayer, Player secondPlayer) {
Party firstParty = Users.getProfile(firstPlayer).getParty();
Party secondParty = Users.getProfile(secondPlayer).getParty();
PlayerProfile firstProfile = Users.getProfile(firstPlayer);
PlayerProfile secondProfile = Users.getProfile(secondPlayer);
if (firstProfile == null || secondProfile == null) {
return false;
}
Party firstParty = firstProfile.getParty();
Party secondParty = secondProfile.getParty();
if (firstParty == null || secondParty == null || firstParty != secondParty) {
return false;