1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Malformed achievements config should not crash stuff anymore.

This commit is contained in:
Mr_Goldberg 2022-08-02 01:16:40 -04:00
parent 173c65a229
commit 0fc5a564e1
No known key found for this signature in database
GPG key ID: 8597D87419DEF278

View file

@ -134,6 +134,16 @@ Steam_User_Stats(Settings *settings, Local_Storage *local_storage, class SteamCa
load_achievements_db(); // achievements db
load_achievements(); // achievements per user
auto x = defined_achievements.begin();
while (x != defined_achievements.end()) {
if (!x->contains("name")) {
x = defined_achievements.erase(x);
} else {
++x;
}
}
for (auto & it : defined_achievements) {
try {
std::string name = static_cast<std::string const&>(it["name"]);
@ -155,6 +165,9 @@ Steam_User_Stats(Settings *settings, Local_Storage *local_storage, class SteamCa
try {
it["hidden"] = std::to_string(it["hidden"].get<int>());
} catch (...) {}
it["displayName"] = it.value("displayName", "");
it["description"] = it.value("description", "");
}
//TODO: not sure if the sort is actually case insensitive, ach names seem to be treated by steam as case insensitive so I assume they are.