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

Fix possible crash.

This commit is contained in:
Mr_Goldberg 2021-04-09 14:52:45 -04:00
parent dc95076faa
commit c48526d49a
No known key found for this signature in database
GPG key ID: 8597D87419DEF278

View file

@ -239,6 +239,7 @@ bool GetAchievement( const char *pchName, bool *pbAchieved )
try { try {
auto it = defined_achievements_find(pchName); auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string()); std::string pch_name = it->value("name", std::string());
auto ach = user_achievements.find(pch_name); auto ach = user_achievements.find(pch_name);
@ -261,6 +262,7 @@ bool SetAchievement( const char *pchName )
try { try {
auto it = defined_achievements_find(pchName); auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string()); std::string pch_name = it->value("name", std::string());
if (it != defined_achievements.end()) { if (it != defined_achievements.end()) {
@ -288,6 +290,7 @@ bool ClearAchievement( const char *pchName )
try { try {
auto it = defined_achievements_find(pchName); auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string()); std::string pch_name = it->value("name", std::string());
if (it != defined_achievements.end()) { if (it != defined_achievements.end()) {
@ -313,6 +316,7 @@ bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32
try { try {
auto it = defined_achievements_find(pchName); auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string()); std::string pch_name = it->value("name", std::string());
auto ach = user_achievements.find(pch_name); auto ach = user_achievements.find(pch_name);
@ -417,6 +421,8 @@ bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint
try { try {
auto it = defined_achievements_find(pchName); auto it = defined_achievements_find(pchName);
if (it == defined_achievements.end()) return false;
std::string pch_name = it->value("name", std::string()); std::string pch_name = it->value("name", std::string());
auto ach = user_achievements.find(pch_name); auto ach = user_achievements.find(pch_name);