From e52009ba83264001b2bab8c2ee780bdd0761e287 Mon Sep 17 00:00:00 2001 From: SteveMcNeill Date: Thu, 1 Aug 2019 13:45:12 -0400 Subject: [PATCH] Fix to CONST crash with Integer Division by Zero error --- source/qb64.bas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/qb64.bas b/source/qb64.bas index 31eba4a90..39f4154c1 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -2159,7 +2159,8 @@ DO altered = -1 wholestv$ = LEFT$(wholestv$, L) + temp1$ + MID$(wholestv$, l2 + 1) ELSE - 'We should leave it as it is and let the normal CONST routine handle things from here on out and see if it passes the rest of the error checks. + IF LEFT$(temp1$, 5) = "ERROR" THEN a$ = temp1$: GOTO errmes + 'If it's not an error, we should leave it as it is and let the normal CONST routine handle things from here on out and see if it passes the rest of the error checks. END IF L = L + 1 END IF @@ -23703,7 +23704,13 @@ FUNCTION EvaluateNumbers$ (p, num() AS STRING) n1 = sign * (n1 ^ n3) CASE "*": n1 = VAL(num(1)) * VAL(num(2)) CASE "/": n1 = VAL(num(1)) / VAL(num(2)) - CASE "\": n1 = VAL(num(1)) \ VAL(num(2)) + CASE "\" + IF VAL(num(2)) <> 0 THEN + n1 = VAL(num(1)) \ VAL(num(2)) + ELSE + EvaluateNumbers$ = "ERROR - Division By Zero" + EXIT FUNCTION + END IF CASE "MOD": n1 = VAL(num(1)) MOD VAL(num(2)) CASE "+": n1 = VAL(num(1)) + VAL(num(2)) CASE "-": n1 = VAL(num(1)) - VAL(num(2))