Hackfix a stack overflow problem.

This commit is contained in:
fullwall 2012-06-11 16:11:54 +08:00
parent de5edc19ad
commit e3d553e0d7

View File

@ -41,8 +41,15 @@ public class GenericWaypointCallback extends NavigationCallback {
} }
} }
boolean hackfix = false;
@Override @Override
public boolean onCancel(AI ai, CancelReason reason) { public boolean onCancel(AI ai, CancelReason reason) {
if (hackfix) {
hackfix = false;
return false;
}
hackfix = false;
if (executing && reason == CancelReason.REPLACE) { if (executing && reason == CancelReason.REPLACE) {
executing = false; executing = false;
return false; return false;
@ -52,7 +59,9 @@ public class GenericWaypointCallback extends NavigationCallback {
if (dest == null && itr.hasNext()) if (dest == null && itr.hasNext())
dest = itr.next().getLocation(); dest = itr.next().getLocation();
if (dest != null) { if (dest != null) {
hackfix = true;
ai.setDestination(dest); ai.setDestination(dest);
hackfix = false;
} }
return false; return false;
} }