Add in checks for potential NPEs. Fixes BUKKIT-1706 and BUKKIT-1590.

This commit is contained in:
Travis Watkins
2012-05-24 19:11:05 -05:00
parent 2f16b8ffa3
commit c1bc0df718
4 changed files with 13 additions and 1 deletions

View File

@@ -443,6 +443,8 @@ public class CraftWorld implements World {
// Forces the client to update to the new time immediately
for (Player p : getPlayers()) {
CraftPlayer cp = (CraftPlayer) p;
if (cp.getHandle().netServerHandler == null) continue;
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime()));
}
}
@@ -767,6 +769,8 @@ public class CraftWorld implements World {
radius *= radius;
for (Player player : getPlayers()) {
if (((CraftPlayer) player).getHandle().netServerHandler == null) continue;
distance = (int) player.getLocation().distanceSquared(location);
if (distance <= radius) {
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet);