aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/expressions.cpp4
-rw-r--r--tests/testsuite.at4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/expressions.cpp b/src/expressions.cpp
index 6c28080..7ccdd31 100644
--- a/src/expressions.cpp
+++ b/src/expressions.cpp
@@ -124,11 +124,11 @@ Expressions::calc(void)
Operator op;
tecoInt vleft;
- if (operators.peek() != OP_NUMBER)
+ if (!operators.items() || operators.peek() != OP_NUMBER)
throw Error("Missing right operand");
vright = pop_num();
op = pop_op();
- if (operators.peek() != OP_NUMBER)
+ if (!operators.items() || operators.peek() != OP_NUMBER)
throw Error("Missing left operand");
vleft = pop_num();
diff --git a/tests/testsuite.at b/tests/testsuite.at
index a9a1322..3288900 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -7,6 +7,10 @@ AT_COLOR_TESTS
# idiom "(0/0)" to enforce a "Division by zero" error
# whenever we want to fail.
+AT_SETUP([Missing left operand])
+AT_CHECK([$SCITECO -e '+23='], 1, ignore, ignore)
+AT_CLEANUP
+
AT_SETUP([Closing loops at the correct macro level])
AT_CHECK([$SCITECO -e '@^Ua{>} <Ma'], 1, ignore, ignore)
AT_CLEANUP