1
0
mirror of https://github.com/libretro/RetroArch synced 2025-02-21 09:39:56 +00:00

Make string_list code more robust

This commit is contained in:
twinaphex 2015-01-28 08:00:19 +01:00
parent c7c1526529
commit bb5d2877cf
2 changed files with 3 additions and 3 deletions

@ -28,7 +28,7 @@ static INLINE void get_title(const char *label, const char *dir,
struct string_list *list_label = string_split(label, "|");
struct string_list *list_path = string_split(dir, "|");
if (list_label)
if (list_label && list_label->size > 0)
{
strlcpy(elem0_label, list_label->elems[0].data, sizeof(elem0_label));
if (list_label->size > 1)
@ -36,7 +36,7 @@ static INLINE void get_title(const char *label, const char *dir,
string_list_free(list_label);
}
if (list_path)
if (list_path && list_path->size > 0)
{
strlcpy(elem0_path, list_path->elems[0].data, sizeof(elem0_path));
if (list_path->size > 1)

@ -3813,7 +3813,7 @@ static int menu_entries_cbs_init_bind_ok_first(menu_file_list_cbs_t *cbs,
menu_list_get_last_stack(driver.menu->menu_list,
NULL, &menu_label, NULL);
if (str_list)
if (str_list && str_list->size > 0)
{
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));