3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 11:00:04 +01:00

Make the null-result case visible to the user

Fixes #1303.

(cherry picked from commit 83438644dcdc470517f67c0d55ff4889f71cc435)
Dieser Commit ist enthalten in:
Octavia Togami 2020-04-18 13:04:03 -07:00 committet von MattBDev
Ursprung ee3a30d582
Commit 3426e0103b

Datei anzeigen

@ -34,8 +34,6 @@ import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Compiles and evaluates expressions. * Compiles and evaluates expressions.
* *
@ -122,7 +120,9 @@ public class Expression {
Instant deadline = Instant.now().plusMillis(timeout); Instant deadline = Instant.now().plusMillis(timeout);
// evaluation exceptions are thrown out of this method // evaluation exceptions are thrown out of this method
Double result = compiledExpression.execute(new ExecutionData(slots, functions, deadline)); 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; return result;
} }