From d84ffcc9153fc54499a2aacfb96e7b6fbba150fb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 6 Dec 2015 21:22:19 +0100 Subject: [PATCH] Attempt to make action_get_title_generic more robust --- menu/cbs/menu_cbs_title.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 09fc48e9e7..481305f3fb 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -130,17 +130,21 @@ static int action_get_title_generic(char *s, size_t len, const char *path, const char *text) { char elem0_path[PATH_MAX_LENGTH] = {0}; - struct string_list *list_path = string_split(path, "|"); + struct string_list *list_path = NULL; + + if (path && path[0] != '\0') + list_path = string_split(path, "|"); if (list_path) { if (list_path->size > 0) strlcpy(elem0_path, list_path->elems[0].data, sizeof(elem0_path)); string_list_free(list_path); + snprintf(s, len, "%s - %s", text, + (elem0_path[0] != '\0') ? path_basename(elem0_path) : ""); } - - snprintf(s, len, "%s - %s", text, - (elem0_path[0] != '\0') ? path_basename(elem0_path) : ""); + else + strlcpy(s, "N/A", len); return 0; }