Make sure core_info_find is called first before using the data struct

This commit is contained in:
libretroadmin 2023-07-15 16:00:48 +02:00
parent 5b52dd4965
commit f39f1f6ff2
4 changed files with 22 additions and 19 deletions

View File

@ -523,8 +523,8 @@ static void menu_action_setting_disp_set_label_core_manager_entry(
* > Note: We search core_info here instead of
* calling core_info_get_core_lock() since we
* don't want to perform disk access every frame */
if (core_info_find(path, &core_info) &&
core_info->is_locked)
if ( core_info_find(path, &core_info)
&& core_info->is_locked)
{
s[0] = '[';
s[1] = '!';
@ -780,8 +780,8 @@ static void menu_action_setting_disp_set_label_core_lock(
* > Note: We search core_info here instead of
* calling core_info_get_core_lock() since we
* don't want to perform disk access every frame */
if (core_info_find(path, &core_info) &&
core_info->is_locked)
if ( core_info_find(path, &core_info)
&& core_info->is_locked)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
@ -811,9 +811,9 @@ static void menu_action_setting_disp_set_label_core_set_standalone_exempt(
* calling core_info_get_core_standalone_exempt()
* since we don't want to perform disk access
* every frame */
if (core_info_find(path, &core_info) &&
core_info->supports_no_game &&
core_info->is_standalone_exempt)
if ( core_info_find(path, &core_info)
&& core_info->supports_no_game
&& core_info->is_standalone_exempt)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);

View File

@ -7703,8 +7703,9 @@ int action_ok_core_lock(const char *path,
/* Need to fetch core name for error message */
/* If core is found, use display name */
if ( core_info->display_name
&& core_info_find(core_path, &core_info))
if (
core_info_find(core_path, &core_info)
&& core_info->display_name)
core_name = core_info->display_name;
/* If not, use core file name */
else
@ -7764,8 +7765,9 @@ int action_ok_core_set_standalone_exempt(const char *path,
/* Need to fetch core name for error message */
/* If core is found, use display name */
if ( core_info->display_name
&& core_info_find(core_path, &core_info))
if (
core_info_find(core_path, &core_info)
&& core_info->display_name)
core_name = core_info->display_name;
/* If not, use core file name */
else
@ -7814,8 +7816,9 @@ static int action_ok_core_delete(const char *path,
/* Need to fetch core name for notification */
/* If core is found, use display name */
if ( core_info->display_name
&& core_info_find(core_path, &core_info))
if (
core_info_find(core_path, &core_info)
&& core_info->display_name)
core_name = core_info->display_name;
/* If not, use core file name */
else

View File

@ -568,8 +568,8 @@ void *task_push_core_backup(
core_info_t *core_info = NULL;
/* If core is found, use display name */
if (core_info_find(core_path, &core_info) &&
core_info->display_name)
if ( core_info_find(core_path, &core_info)
&& core_info->display_name)
core_name = core_info->display_name;
else
{
@ -992,8 +992,8 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
/* Get core name
* > If core is found, use display name */
if (core_info_find(core_path, &core_info) &&
core_info->display_name)
if ( core_info_find(core_path, &core_info)
&& core_info->display_name)
core_name = core_info->display_name;
else
{

View File

@ -392,8 +392,8 @@ static void pl_manager_validate_core_association(
core_info_t *core_info = NULL;
/* Search core info */
if (core_info_find(core_path, &core_info) &&
!string_is_empty(core_info->display_name))
if ( core_info_find(core_path, &core_info)
&& !string_is_empty(core_info->display_name))
strlcpy(core_display_name, core_info->display_name,
sizeof(core_display_name));
else