aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-21 08:39:49 +0100
committerDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-21 08:39:49 +0100
commit5dd30eea54d5b1ef25e517505c5a47ff1a37c424 (patch)
tree075a26e4e2d3e2eb1246ff3f6a151c5719656ea3
parentc5469ba6723eaecc5797acc842d090e1b85afb60 (diff)
downloadunja-5dd30eea54d5b1ef25e517505c5a47ff1a37c424.tar.gz
unja-5dd30eea54d5b1ef25e517505c5a47ff1a37c424.zip
handle invalid operators (although not possible because of parsing, this fixes a clang warning)
-rw-r--r--src/template.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/template.c b/src/template.c
index cf021c1..6949068 100644
--- a/src/template.c
+++ b/src/template.c
@@ -425,11 +425,15 @@ struct unja_object *eval_infix_expression(struct unja_object *left, char *op, st
case '!':
if (op[1] == '=') {
result = object_to_int(left) != object_to_int(right);
+ } else {
+ errx(EXIT_FAILURE, "invalid int operator: %s", op);
}
break;
case '=':
if (op[1] == '=') {
result = object_to_int(left) == object_to_int(right);
+ } else {
+ errx(EXIT_FAILURE, "invalid int operator: %s", op);
}
break;
}