From d4ca28c51a46918607ca0cb7cde2257f2a7869ec Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:01:42 +0300 Subject: [PATCH] dont reinvent the wheel --- loader/include/Geode/utils/general.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/general.hpp b/loader/include/Geode/utils/general.hpp index c174658c..60b6e767 100644 --- a/loader/include/Geode/utils/general.hpp +++ b/loader/include/Geode/utils/general.hpp @@ -137,8 +137,9 @@ namespace geode { if constexpr (std::is_floating_point_v) res = std::from_chars(str.data(), str.data() + str.size(), result); else res = std::from_chars(str.data(), str.data() + str.size(), result, base); - auto [_, ec] = res; + auto [ptr, ec] = res; if (ec == std::errc()) return Ok(result); + else if (ptr != str.data() + str.size()) return Err("String contains trailing extra data"); else if (ec == std::errc::invalid_argument) return Err("String is not a number"); else if (ec == std::errc::result_out_of_range) return Err("Number is too large to fit"); else return Err("Unknown error");