forked from MagicBane/Server
null check
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user