Skip to content

Commit

Permalink
Fix NPE when //genbiome expression was false.
Browse files Browse the repository at this point in the history
Fixes WORLDEDIT-3467.
  • Loading branch information
wizjany authored and DarkArc committed Jul 17, 2016
1 parent 9effc50 commit cd50942
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -2301,7 +2301,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)
Expand Down
Expand Up @@ -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" +
Expand Down
Expand Up @@ -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;
}
Expand Down

0 comments on commit cd50942

Please sign in to comment.