Permalink
Browse files

Fix NPE when //genbiome expression was false.

Fixes WORLDEDIT-3467.
  • Loading branch information...
wizjany authored and DarkArc committed Jul 6, 2016
1 parent 57c2ab5 commit 97e821df393aa32516faa483281d28c88124a750
@@ -2340,7 +2340,7 @@ protected BaseBiome getBiome(int x, int z, BaseBiome defaultBiomeType) {
try {
if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) {
return null;
return null; // TODO should return OUTSIDE? seems to cause issues otherwise, workedaround for now
}
// TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping)
@@ -316,12 +316,12 @@ public void generate(Player player, LocalSession session, EditSession editSessio
@Command(
aliases = { "/generatebiome", "/genbiome", "/gb" },
usage = "<block> <expression>",
usage = "<biome> <expression>",
desc = "Sets biome according to a formula.",
help =
"Generates a shape according to a formula that is expected to\n" +
"return positive numbers (true) if the point is inside the shape\n" +
"Optionally set type/data to the desired block.\n" +
"Sets the biome of blocks in that shape.\n" +
"Flags:\n" +
" -h to generate a hollow shape\n" +
" -r to use raw minecraft coordinates\n" +
@@ -136,7 +136,7 @@ public int generate(EditSession editSession, BaseBiome baseBiome, boolean hollow
if (!hollow) {
final BaseBiome material = getBiome(x, z, baseBiome);
if (material != OUTSIDE) {
if (material != null && material != OUTSIDE) {
editSession.getWorld().setBiome(position, material);
++affected;
}

0 comments on commit 97e821d

Please sign in to comment.