1
0
mirror of synced 2025-01-18 00:56:49 +01:00

fix: Warnings when trying to load progress for achievements that aren't in save file

This commit is contained in:
WerWolv 2023-12-31 13:53:28 +01:00
parent 950eaea8af
commit e2b7a69fc8

View File

@ -201,7 +201,11 @@ namespace hex {
for (const auto &[categoryName, achievements] : getAchievements()) {
for (const auto &[achievementName, achievement] : achievements) {
try {
achievement->setProgress(json[categoryName][achievementName]);
const auto &progress = json[categoryName][achievementName];
if (progress.is_null())
continue;
achievement->setProgress(progress);
} catch (const std::exception &e) {
log::warn("Failed to load achievement progress for '{}::{}': {}", categoryName, achievementName, e.what());
}