From 29b421512a4b74f67e51cf82ca90668b71715306 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 21 Nov 2017 19:22:44 +0100 Subject: [PATCH] Try to be safer --- command.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/command.c b/command.c index 4003ec563c..ebd7e9c2a8 100644 --- a/command.c +++ b/command.c @@ -1379,17 +1379,22 @@ static bool command_event_save_config(const char *config_path, { if (string_is_empty(config_path) || !config_save_file(config_path)) { - snprintf(s, len, "%s \"%s\".", - msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO), - path_get(RARCH_PATH_CONFIG)); - RARCH_ERR("%s\n", s); + const char *str = path_get(RARCH_PATH_CONFIG); + + if (string_is_empty(str)) + { + snprintf(s, len, "%s \"%s\".", + msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO), + str); + RARCH_ERR("%s\n", s); + } return false; } snprintf(s, len, "[Config]: %s \"%s\".", msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO), - path_get(RARCH_PATH_CONFIG)); + config_path); RARCH_LOG("%s\n", s); return true; } @@ -1490,7 +1495,8 @@ static bool command_event_save_core_config(void) command_event_save_config(config_path, msg, sizeof(msg)); - runloop_msg_queue_push(msg, 1, 180, true); + if (!string_is_empty(msg)) + runloop_msg_queue_push(msg, 1, 180, true); if (overrides_active) rarch_ctl(RARCH_CTL_SET_OVERRIDES_ACTIVE, NULL);