Fix a NPE when tab completing with /ptp

Fixes #2013
This commit is contained in:
TfT_02 2014-05-11 18:33:50 +02:00
parent 8fec1af257
commit ead716ef0d

View File

@ -115,9 +115,13 @@ public class PtpCommand implements TabExecutor {
if (matches.size() == 0) { if (matches.size() == 0) {
Player player = (Player) sender; Player player = (Player) sender;
Party party = UserManager.getPlayer(player).getParty(); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
List<String> playerNames = party.getOnlinePlayerNames(player); if (!mcMMOPlayer.inParty()) {
return ImmutableList.of();
}
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
} }