Skip to content

Commit 29d31b9

Browse files
author
Ian Gonzalez Hermosillo
committed
can't upgrade nonexistent tower
1 parent 024c428 commit 29d31b9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

engine/src/main/battlecode/world/RobotControllerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,9 @@ private void assertCanUpgradeTower(MapLocation loc) throws GameActionException{
610610
assertCanActLocation(loc, GameConstants.BUILD_TOWER_RADIUS_SQUARED);
611611
InternalRobot robot = this.gameWorld.getRobot(loc);
612612

613+
if (robot == null){
614+
throw new GameActionException(CANT_DO_THAT, "There is no robot at the location");
615+
}
613616
if (!this.robot.getType().isTowerType()){
614617
throw new GameActionException(CANT_DO_THAT, "No tower at the location");
615618
}

0 commit comments

Comments
 (0)