mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-19 04:17:50 +03:00
Possible ArrayIndexOutOfBounds fix
This commit is contained in:
parent
9de04a24fd
commit
53996ad82c
@ -413,6 +413,7 @@ public class ControlPathfinder implements Runnable{
|
||||
|
||||
Cluster[] dim2 = dim1[pathCost];
|
||||
|
||||
//TODO: how can index out of bounds happen? || clusterIndex >= dim2.length
|
||||
if(dim2 == null) return null;
|
||||
|
||||
return dim2[clusterIndex];
|
||||
@ -827,7 +828,7 @@ public class ControlPathfinder implements Runnable{
|
||||
if(nextCx >= 0 && nextCy >= 0 && nextCx < cwidth && nextCy < cheight){
|
||||
Cluster nextCluster = getCreateCluster(team, pathCost, nextCx, nextCy);
|
||||
int relativeDir = (dir + 2) % 4;
|
||||
LongSeq outerCons = nextCluster.portalConnections[relativeDir] == null ? null : nextCluster.portalConnections[relativeDir][portal];
|
||||
LongSeq outerCons = nextCluster.portalConnections[relativeDir] == null || nextCluster.portalConnections[relativeDir].length <= portal ? null : nextCluster.portalConnections[relativeDir][portal];
|
||||
if(outerCons != null){
|
||||
checkEdges(request, team, pathCost, current, endNodeIndex, nextCx, nextCy, outerCons);
|
||||
}
|
||||
@ -1075,6 +1076,10 @@ public class ControlPathfinder implements Runnable{
|
||||
return getPathPosition(unit, destination, destination, out, noResultFound);
|
||||
}
|
||||
|
||||
public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 out, @Nullable boolean[] noResultFound){
|
||||
return getPathPosition(unit, destination, destination, out, noResultFound);
|
||||
}
|
||||
|
||||
public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination, Vec2 out, @Nullable boolean[] noResultFound){
|
||||
int costId = unit.type.pathCostId;
|
||||
PathCost cost = idToCost(costId);
|
||||
|
Loading…
Reference in New Issue
Block a user