Skip to content

Commit d4ca28c

Browse files
authored
dont reinvent the wheel
1 parent 9e82cee commit d4ca28c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

loader/include/Geode/utils/general.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ namespace geode {
137137
if constexpr (std::is_floating_point_v<Num>) res = std::from_chars(str.data(), str.data() + str.size(), result);
138138
else res = std::from_chars(str.data(), str.data() + str.size(), result, base);
139139

140-
auto [_, ec] = res;
140+
auto [ptr, ec] = res;
141141
if (ec == std::errc()) return Ok(result);
142+
else if (ptr != str.data() + str.size()) return Err("String contains trailing extra data");
142143
else if (ec == std::errc::invalid_argument) return Err("String is not a number");
143144
else if (ec == std::errc::result_out_of_range) return Err("Number is too large to fit");
144145
else return Err("Unknown error");

0 commit comments

Comments
 (0)