From 3426e0103be0f24a15497a9801fda8dda0a47c7f Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Sat, 18 Apr 2020 13:04:03 -0700 Subject: [PATCH] Make the null-result case visible to the user Fixes #1303. (cherry picked from commit 83438644dcdc470517f67c0d55ff4889f71cc435) --- .../com/sk89q/worldedit/internal/expression/Expression.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index c9cd732e9..20996c09f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -34,8 +34,6 @@ import java.time.Instant; import java.util.List; import java.util.Objects; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Compiles and evaluates expressions. * @@ -122,7 +120,9 @@ public class Expression { Instant deadline = Instant.now().plusMillis(timeout); // evaluation exceptions are thrown out of this method Double result = compiledExpression.execute(new ExecutionData(slots, functions, deadline)); - checkNotNull(result, "Expression must result in a value"); + if (result == null) { + throw new EvaluationException(-1, "Expression must result in a value"); + } return result; }