From f39f1f6ff2af696b661c6d557988980cd7402957 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Sat, 15 Jul 2023 16:00:48 +0200 Subject: [PATCH] Make sure core_info_find is called first before using the data struct --- menu/cbs/menu_cbs_get_value.c | 14 +++++++------- menu/cbs/menu_cbs_ok.c | 15 +++++++++------ tasks/task_core_backup.c | 8 ++++---- tasks/task_playlist_manager.c | 4 ++-- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 7fd8339a1d..dbeabcb2d7 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -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); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index a6e1302ac1..0acfaeef6d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -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 diff --git a/tasks/task_core_backup.c b/tasks/task_core_backup.c index 68c48dc514..9112f04986 100644 --- a/tasks/task_core_backup.c +++ b/tasks/task_core_backup.c @@ -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 { diff --git a/tasks/task_playlist_manager.c b/tasks/task_playlist_manager.c index 7d7a993097..59f57a6fa6 100644 --- a/tasks/task_playlist_manager.c +++ b/tasks/task_playlist_manager.c @@ -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