From 6e45c371c4098942e0085a71577a07b17725ee93 Mon Sep 17 00:00:00 2001 From: Treeston Date: Thu, 27 Aug 2020 21:26:14 +0200 Subject: Common/Utilities: Properly read std::from_chars documentation and check for out_of_range errors. (cherry picked from commit 7478c2c65aea853a2086c9c7ecc56c14ad6ee338) --- src/common/Utilities/StringConvert.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/Utilities/StringConvert.h b/src/common/Utilities/StringConvert.h index f90e47cab10..fbdc41f6aef 100644 --- a/src/common/Utilities/StringConvert.h +++ b/src/common/Utilities/StringConvert.h @@ -69,7 +69,7 @@ namespace Trinity::Impl::StringConvertImpl T val; std::from_chars_result const res = std::from_chars(start, end, val, base); - if (res.ptr == end) + if ((res.ptr == end) && (res.ec == std::errc())) return val; else return std::nullopt; -- cgit v1.2.3