Fix potential NPE in vanish API. Fixes BUKKIT-1541

Dieser Commit ist enthalten in:
Travis Watkins 2012-04-24 12:25:07 -05:00 committet von EvilSeph
Ursprung 0220c1ff74
Commit 9c12dc0ef8

Datei anzeigen

@ -596,6 +596,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (hiddenPlayers.containsKey(player.getName())) return; if (hiddenPlayers.containsKey(player.getName())) return;
hiddenPlayers.put(player.getName(), player); hiddenPlayers.put(player.getName(), player);
if (getHandle().netServerHandler == null) {
return;
}
//remove this player from the hidden player's EntityTrackerEntry //remove this player from the hidden player's EntityTrackerEntry
EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle(); EntityPlayer other = ((CraftPlayer) player).getHandle();
@ -614,6 +618,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (!hiddenPlayers.containsKey(player.getName())) return; if (!hiddenPlayers.containsKey(player.getName())) return;
hiddenPlayers.remove(player.getName()); hiddenPlayers.remove(player.getName());
if (getHandle().netServerHandler == null) {
return;
}
EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle(); EntityPlayer other = ((CraftPlayer) player).getHandle();
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id); EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id);