Skip to content

Commit 1df79f0

Browse files
committed
fix: add error handling for empty expression in evaluate methods of ExpressionParser
1 parent 0349c04 commit 1df79f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/java/mindustrytool/workflow/expressions/ExpressionParser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ public <T> T evaluate(Class<T> type, String expr, Map<String, Object> variables)
160160
Queue<String> rpn = toExpressionQueue(expr, variables);
161161
Deque<Object> stack = new ArrayDeque<>();
162162

163+
if (rpn.isEmpty()) {
164+
throw new WorkflowError("Empty stack, expression: " + expr);
165+
}
166+
163167
for (String token : rpn) {
164168
token = token.trim();
165169

0 commit comments

Comments
 (0)