Merge pull request #2992 from orestisf1993/next

i3bar: fix segfault when no status_command is provided
This commit is contained in:
Ingo Bürk 2017-09-27 21:47:52 +02:00 committed by GitHub
commit a05773e18b
1 changed files with 2 additions and 2 deletions

View File

@ -177,7 +177,7 @@ void got_bar_config_update(char *event) {
/* update the configuration with the received settings */ /* update the configuration with the received settings */
DLOG("Received bar config update \"%s\"\n", event); DLOG("Received bar config update \"%s\"\n", event);
char *old_command = sstrdup(config.command); char *old_command = config.command ? sstrdup(config.command) : NULL;
bar_display_mode_t old_mode = config.hide_on_modifier; bar_display_mode_t old_mode = config.hide_on_modifier;
parse_config_json(event); parse_config_json(event);
if (old_mode != config.hide_on_modifier) { if (old_mode != config.hide_on_modifier) {
@ -189,7 +189,7 @@ void got_bar_config_update(char *event) {
init_colors(&(config.colors)); init_colors(&(config.colors));
/* restart status command process */ /* restart status command process */
if (strcmp(old_command, config.command) != 0) { if (old_command && strcmp(old_command, config.command) != 0) {
kill_child(); kill_child();
start_child(config.command); start_child(config.command);
} }