diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index b56740edd2..afdfa818a7 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -367,7 +367,8 @@ end: free(avg_filtered); free(paeth_filtered); - stream_backend->stream_free(stream); + if (stream_backend) + stream_backend->stream_free(stream); return ret; } diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 6fb8f5221e..f1854591ca 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -410,7 +410,10 @@ static int general_push(menu_displaylist_info_t *info, sizeof(info->exts)); } else - strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); + { + if (system->valid_extensions) + strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); + } break; case PUSH_DETECT_CORE_LIST: if (!string_is_empty(list->all_ext)) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index c46c3bb22c..d498f158b3 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -155,8 +155,9 @@ int generic_action_ok_displaylist_push(const char *path, menu_path = menu->scratch2_buf; content_path = menu->scratch_buf; } - fill_pathname_join(detect_content_path, menu_path, content_path, - sizeof(detect_content_path)); + if (content_path) + fill_pathname_join(detect_content_path, menu_path, content_path, + sizeof(detect_content_path)); switch (action_type) { diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 22c207b4e1..e526d8a522 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -453,12 +453,12 @@ int menu_entries_get_core_title(char *s, size_t len) if (!settings->menu.core_enable) return -1; - if (string_is_empty(core_name)) + if (string_is_empty(core_name) && info) core_name = info->info.library_name; if (string_is_empty(core_name)) core_name = menu_hash_to_str(MENU_VALUE_NO_CORE); - if (!core_version) + if (!core_version && info) core_version = info->info.library_version; if (!core_version) core_version = ""; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 8386f2d63b..28a9977bb8 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2499,8 +2499,6 @@ static int setting_action_left_libretro_device_type( settings_t *settings = config_get_ptr(); rarch_system_info_t *system = NULL; - runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); - if (!setting) return -1; @@ -2509,13 +2507,18 @@ static int setting_action_left_libretro_device_type( devices[types++] = RETRO_DEVICE_NONE; devices[types++] = RETRO_DEVICE_JOYPAD; - /* Only push RETRO_DEVICE_ANALOG as default if we use an - * older core which doesn't use SET_CONTROLLER_INFO. */ - if (!system->ports.size) - devices[types++] = RETRO_DEVICE_ANALOG; + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); - if (port < system->ports.size) - desc = &system->ports.data[port]; + if (system) + { + /* Only push RETRO_DEVICE_ANALOG as default if we use an + * older core which doesn't use SET_CONTROLLER_INFO. */ + if (!system->ports.size) + devices[types++] = RETRO_DEVICE_ANALOG; + + if (port < system->ports.size) + desc = &system->ports.data[port]; + } if (desc) { @@ -3068,9 +3071,10 @@ void general_write_handler(void *data) video_driver_set_filtering(1, settings->video.smooth); break; case MENU_LABEL_VIDEO_ROTATION: - video_driver_set_rotation( - (*setting->value.target.unsigned_integer + - system->rotation) % 4); + if (system) + video_driver_set_rotation( + (*setting->value.target.unsigned_integer + + system->rotation) % 4); break; case MENU_LABEL_AUDIO_VOLUME: audio_driver_set_volume_gain(db_to_gain(*setting->value.target.fraction)); diff --git a/tasks/task_content.c b/tasks/task_content.c index c3bb56109f..23168b20dc 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1411,7 +1411,7 @@ static bool content_file_init(struct string_list *temporary_content) runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); - if (*global->subsystem) + if (*global->subsystem && system) { special = init_content_file_subsystem(&ret, system); if (!ret) @@ -1559,7 +1559,7 @@ static void menu_content_environment_get(int *argc, char *argv[], wrap_args->sram_path = global->dir.savefile; if (*global->dir.savestate) wrap_args->state_path = global->dir.savestate; - if (*fullpath) + if (fullpath && *fullpath) wrap_args->content_path = fullpath; if (!global->has_set.libretro) wrap_args->libretro_path = *settings->path.libretro diff --git a/tasks/task_database.c b/tasks/task_database.c index b3224fc5f6..c5a7d64a40 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -310,7 +310,8 @@ static int database_info_list_iterate_found_match( snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32); - strlcpy(entry_path_str, entry_path, sizeof(entry_path_str)); + if (entry_path) + strlcpy(entry_path_str, entry_path, sizeof(entry_path_str)); if (!string_is_empty(zip_name)) fill_pathname_join_delim(entry_path_str, entry_path_str, zip_name,