Browse Source

null check

feature-workorder
FatBoy-DOTC 1 year ago
parent
commit
c3e206e3b1
  1. 7
      src/engine/net/client/handlers/MoveToPointHandler.java

7
src/engine/net/client/handlers/MoveToPointHandler.java

@ -37,10 +37,11 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
Enum.GameObjectType targetType; Enum.GameObjectType targetType;
targetType = Enum.GameObjectType.values()[msg.getTargetType()]; targetType = Enum.GameObjectType.values()[msg.getTargetType()];
switch(targetType){ if(targetType != null) {
switch (targetType) {
case Building: case Building:
target = BuildingManager.getBuilding(msg.getTargetID()); target = BuildingManager.getBuilding(msg.getTargetID());
if(target == null) if (target == null)
return true;// early exit for no building pulled return true;// early exit for no building pulled
Building targetBuilding = (Building) target; Building targetBuilding = (Building) target;
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0)
@ -49,7 +50,7 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
case NPC: case NPC:
return true;//cannot attack anything other than the 3 above return true;//cannot attack anything other than the 3 above
} }
}
MovementManager.movement(msg, pc); MovementManager.movement(msg, pc);
return true; return true;
} }

Loading…
Cancel
Save