From 37f8c150b7bca905a4cd19793649cfdb6409cdd4 Mon Sep 17 00:00:00 2001 From: androidmage Date: Mon, 11 Jan 2016 23:07:13 -0500 Subject: [PATCH] Guard Null pointer exception actually fixed --- RobotPlayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RobotPlayer.java b/RobotPlayer.java index 0181a80..14737c7 100644 --- a/RobotPlayer.java +++ b/RobotPlayer.java @@ -174,7 +174,7 @@ public void run() { if(rc.isCoreReady()){ RobotInfo[] robots = rc.senseNearbyRobots(); boolean targetFound = false; - if(robots != null){ + if(robots != null && archonLocation != null){ for(RobotInfo robot:robots){ if(robot.location.distanceSquaredTo(archonLocation) < 25){ targetFound = true; @@ -182,7 +182,7 @@ public void run() { } } } - if(targetFound == false){ + if(targetFound == false && archonLocation != null){ RESOURCE_FUNCTIONS.BUG(archonLocation); } } @@ -203,7 +203,7 @@ public void run() { RESOURCE_FUNCTIONS.attackWeakestEnemy(); //If didn't attack anyone that is adjacent - if(rc.isWeaponReady()){ + if(rc.isWeaponReady() && robots != null && archonLocation != null){ MapLocation target = null; for(RobotInfo robot: robots) { if((robot.team == Team.ZOMBIE) && robot.location.distanceSquaredTo(archonLocation) < 25) {