From 2d9727f499229ccc5095e645796e801b3130af1f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 18 Jan 2018 06:32:50 +0100 Subject: [PATCH] Simplify sanitize_to_string further --- menu/cbs/menu_cbs_title.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index b343b32510..c5f99e6dc6 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -31,8 +31,6 @@ static void sanitize_to_string(char *s, const char *label, size_t len) { char *pos = NULL; - if (string_is_empty(label) || !s) - return; strlcpy(s, label, len); @@ -51,14 +49,17 @@ static int fill_title(char *s, const char *title, const char *path, size_t len) static int action_get_title_action_generic(const char *path, const char *label, unsigned menu_type, char *s, size_t len) { - sanitize_to_string(s, label, len); + if (s && !string_is_empty(label)) + sanitize_to_string(s, label, len); return 0; } #define default_title_macro(func_name, lbl) \ static int (func_name)(const char *path, const char *label, unsigned menu_type, char *s, size_t len) \ { \ - sanitize_to_string(s, msg_hash_to_str(lbl), len); \ + const char *str = msg_hash_to_str(lbl); \ + if (s && !string_is_empty(str)) \ + sanitize_to_string(s, str, len); \ return 0; \ }