diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-03 13:15:49 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-03 13:15:49 +0200 |
| commit | 59f55a21193ec7461205f4bb95303b69f3f7ce1c (patch) | |
| tree | d175982cbdc238ce28bbe59501fe5882962cdf28 /src/exact_value.cpp | |
| parent | 8bac82320fbba53a440bf42b117c702e726db093 (diff) | |
Make `big_int_from_string` return an error if not an integer.
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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; } |