From c957ffb95aec0764a66608b203e88db1c77d3ed7 Mon Sep 17 00:00:00 2001 From: wizjany Date: Wed, 6 Jul 2016 11:14:11 -0400 Subject: [PATCH] Fix NPE when //genbiome expression was false. Fixes WORLDEDIT-3467. --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 +- .../java/com/sk89q/worldedit/command/GenerationCommands.java | 4 ++-- .../sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 3253fb61a..abb4f4909 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2301,7 +2301,7 @@ public class EditSession implements Extent { 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) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index 09abf3b99..edda882a8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -316,12 +316,12 @@ public class GenerationCommands { @Command( aliases = { "/generatebiome", "/genbiome", "/gb" }, - usage = " ", + usage = " ", 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" + diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java index 485f5834a..942b55c6c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java @@ -136,7 +136,7 @@ public abstract class ArbitraryBiomeShape { if (!hollow) { final BaseBiome material = getBiome(x, z, baseBiome); - if (material != OUTSIDE) { + if (material != null && material != OUTSIDE) { editSession.getWorld().setBiome(position, material); ++affected; }