From 6bf45a35e2566c90b9171a2022b3c6f179856c3a Mon Sep 17 00:00:00 2001 From: otavepto <153766569+otavepto@users.noreply.github.com> Date: Sun, 23 Jun 2024 00:31:39 +0300 Subject: [PATCH] avoid a scenario where progress might exist but not max_progress is user data --- dll/steam_user_stats.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dll/steam_user_stats.cpp b/dll/steam_user_stats.cpp index a629f632..e0ede21f 100644 --- a/dll/steam_user_stats.cpp +++ b/dll/steam_user_stats.cpp @@ -774,8 +774,11 @@ Steam_User_Stats::Steam_User_Stats(Settings *settings, class Networking *network user_ach.emplace("earned_time", static_cast(0)); // they will throw an exception for achievements with no progress try { - user_ach.emplace("progress", std::stof(trig.min_value)); - user_ach.emplace("max_progress", std::stof(trig.max_value)); + uint32 progress_min = std::stoul(trig.min_value); + uint32 progress_max = std::stoul(trig.max_value); + // if the above lines didn't throw exception then add the values + user_ach.emplace("progress", progress_min); + user_ach.emplace("max_progress", progress_max); } catch(...) {} } catch(...) {}