From 2128d6abf9764a9aad8333ff016ce436a3df34c2 Mon Sep 17 00:00:00 2001 From: mtardy Date: Tue, 11 Aug 2020 14:13:27 +0200 Subject: [PATCH] Print error in case of non-integer in arithmetic operation --- object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/object.c b/object.c index 6b48b00..93d3636 100644 --- a/object.c +++ b/object.c @@ -177,6 +177,10 @@ void println(oop ast); int getInteger(oop obj) { + if (!isInteger(obj)) { + fprintf(stderr, "\nNon-integer in arithmetic expression\n"); + exit(1); + } #if (USE_TAG) return (intptr_t)obj >> 1; #else