mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-12-24 11:48:34 +01:00
Malformed achievements config should not crash stuff anymore.
This commit is contained in:
parent
173c65a229
commit
0fc5a564e1
1 changed files with 13 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue