From 59f55a21193ec7461205f4bb95303b69f3f7ce1c Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Tue, 3 May 2022 13:15:49 +0200 Subject: Make `big_int_from_string` return an error if not an integer. --- src/exact_value.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/exact_value.cpp') diff --git a/src/exact_value.cpp b/src/exact_value.cpp index cedef48c4..175cb61f6 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -177,7 +177,11 @@ ExactValue exact_value_typeid(Type *type) { ExactValue exact_value_integer_from_string(String const &string) { ExactValue result = {ExactValue_Integer}; - big_int_from_string(&result.value_integer, string); + bool success; + big_int_from_string(&result.value_integer, string, &success); + if (!success) { + result = {ExactValue_Invalid}; + } return result; } -- cgit v1.2.3