diff --git a/src/engine/net/client/handlers/MoveToPointHandler.java b/src/engine/net/client/handlers/MoveToPointHandler.java index f81f5111..18076967 100644 --- a/src/engine/net/client/handlers/MoveToPointHandler.java +++ b/src/engine/net/client/handlers/MoveToPointHandler.java @@ -37,19 +37,20 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { Enum.GameObjectType targetType; targetType = Enum.GameObjectType.values()[msg.getTargetType()]; - switch(targetType){ - case Building: - target = BuildingManager.getBuilding(msg.getTargetID()); - if(target == null) - return true;// early exit for no building pulled - Building targetBuilding = (Building) target; - if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) - return true;// cannot attack destroyed building or protected building - break; - case NPC: - return true;//cannot attack anything other than the 3 above + if(targetType != null) { + switch (targetType) { + case Building: + target = BuildingManager.getBuilding(msg.getTargetID()); + if (target == null) + return true;// early exit for no building pulled + Building targetBuilding = (Building) target; + if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) + return true;// cannot attack destroyed building or protected building + break; + case NPC: + return true;//cannot attack anything other than the 3 above + } } - MovementManager.movement(msg, pc); return true; }