mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-10-30 21:20:10 +00:00
Malformed achievements config should not crash stuff anymore.
This commit is contained in:
parent
173c65a229
commit
0fc5a564e1
@ -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 New Issue
Block a user