prevent null reference rendering achievement list while closing emulator

This commit is contained in:
Jamiras 2020-04-04 09:28:11 -06:00
parent 1d7cae2ceb
commit ff3b033815

View File

@ -1133,12 +1133,12 @@ void rcheevos_get_achievement_state(unsigned index, char *buffer, size_t buffer_
if (index < rcheevos_locals.patchdata.core_count) if (index < rcheevos_locals.patchdata.core_count)
{ {
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY; enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY;
cheevo = &rcheevos_locals.core[index]; cheevo = rcheevos_locals.core ? &rcheevos_locals.core[index] : NULL;
} }
else else
{ {
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNOFFICIAL_ENTRY; enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNOFFICIAL_ENTRY;
cheevo = &rcheevos_locals.unofficial[index - rcheevos_locals.patchdata.core_count]; cheevo = rcheevos_locals.unofficial ? &rcheevos_locals.unofficial[index - rcheevos_locals.patchdata.core_count] : NULL;
} }
if (!cheevo || !cheevo->trigger) if (!cheevo || !cheevo->trigger)