Hopefully reduce the chance of index out of bounds exceptions

This commit is contained in:
James Seibel
2021-07-25 20:51:52 -05:00
parent 286fc91db6
commit fa98454151
@@ -388,13 +388,22 @@ public class LodDimension
public int getWidth()
{
return width;
if (regions != null)
{
// we want to get the length directly from the
// source to make sure it is in sync with region
// and isRegionDirty
return regions.length;
}
else
{
return width;
}
}
public void setRegionWidth(int newWidth)
{
width = newWidth;
halfWidth = (int)Math.floor(width / 2);
regions = new LodRegion[width][width];
isRegionDirty = new boolean[width][width];