From ead716ef0d0c194c25c33f72b3232f9070b0f504 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 11 May 2014 18:33:50 +0200 Subject: [PATCH] Fix a NPE when tab completing with /ptp Fixes #2013 --- .../gmail/nossr50/commands/party/teleport/PtpCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java index e7443de42..7011834e7 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java @@ -115,9 +115,13 @@ public class PtpCommand implements TabExecutor { if (matches.size() == 0) { Player player = (Player) sender; - Party party = UserManager.getPlayer(player).getParty(); + McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - List playerNames = party.getOnlinePlayerNames(player); + if (!mcMMOPlayer.inParty()) { + return ImmutableList.of(); + } + + List playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList(playerNames.size())); }