From fd4e94220fdac1971564b18d5a884e02cd4694b5 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Fri, 13 Jul 2012 12:16:15 +0200 Subject: [PATCH] Fixed a NullPointerException in ifs without an else. The NPE occured if the condition was not optimizable to a constant. --- .../com/sk89q/worldedit/expression/runtime/Conditional.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/sk89q/worldedit/expression/runtime/Conditional.java b/src/main/java/com/sk89q/worldedit/expression/runtime/Conditional.java index a6718fca7..3c1e52617 100644 --- a/src/main/java/com/sk89q/worldedit/expression/runtime/Conditional.java +++ b/src/main/java/com/sk89q/worldedit/expression/runtime/Conditional.java @@ -74,6 +74,6 @@ public class Conditional extends Node { } } - return new Conditional(getPosition(), newCondition, truePart.optimize(), falsePart.optimize()); + return new Conditional(getPosition(), newCondition, truePart.optimize(), falsePart == null ? null : falsePart.optimize()); } }