Add some extra array bounds protection

This commit is contained in:
Mike Primm 2012-02-11 23:28:44 -06:00
parent 1ef9bdd861
commit 0053d89d2b

View File

@ -160,14 +160,23 @@ public class NewMapChunkCache implements MapChunkCache {
} }
public final BiomeMap getBiome() { public final BiomeMap getBiome() {
try {
return biomemap[x - x_base][z - z_base]; return biomemap[x - x_base][z - z_base];
} catch (Exception ex) {
return BiomeMap.NULL;
}
} }
public final int countSmoothedSwampBiomes() { public final int countSmoothedSwampBiomes() {
try {
return swampcnt[x - x_base][z - z_base]; return swampcnt[x - x_base][z - z_base];
} catch (Exception ex) {
return 0;
}
} }
public final int countSmoothedSwampBiomes(int sx, int sz, int scale) { public final int countSmoothedSwampBiomes(int sx, int sz, int scale) {
try {
int xx = x - x_base; int xx = x - x_base;
int zz = z - z_base; int zz = z - z_base;
sx <<= 1; sx <<= 1;
@ -198,6 +207,9 @@ public class NewMapChunkCache implements MapChunkCache {
tot += scale * s0; tot += scale * s0;
} }
return tot; return tot;
} catch (Exception ex) {
return 0;
}
} }
public final double getRawBiomeTemperature() { public final double getRawBiomeTemperature() {