Probable getBlock array index out of bounds NPE fix.
This commit is contained in:
parent
d048eb9816
commit
77e5379d97
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class GeoEngine
|
|||||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||||
|
|
||||||
// if x or y is out of array return null
|
// if x or y is out of array return null
|
||||||
if ((x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
if ((x > -1) && (y > -1) && (x < GeoStructure.GEO_BLOCKS_X) && (y < GeoStructure.GEO_BLOCKS_Y))
|
||||||
{
|
{
|
||||||
return _blocks[x][y];
|
return _blocks[x][y];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user