From: Michael Stapelberg Date: Tue, 18 Aug 2009 20:09:07 +0000 (+0200) Subject: Bugfix: Correctly terminate output if time is specified in order but no time_format... X-Git-Tag: 2.0~37 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=39b153fdd100088b567130a354824ef49b190009;p=i3%2Fi3status Bugfix: Correctly terminate output if time is specified in order but no time_format given (Thanks XTaran) --- diff --git a/i3status.c b/i3status.c index 04fa57f..37e6639 100644 --- a/i3status.c +++ b/i3status.c @@ -152,12 +152,16 @@ int main(int argc, char *argv[]) { generate(ORDER_BATTERY, "battery", get_battery_info(current)); } - if (j == order[ORDER_TIME] && time_format != NULL) { - /* Get date & time */ - time_t current_time = time(NULL); - struct tm *current_tm = localtime(¤t_time); - (void)strftime(part, sizeof(part), time_format, current_tm); - generate(ORDER_TIME, "time", part); + if (j == order[ORDER_TIME]) { + if (time_format != NULL) { + /* Get date & time */ + time_t current_time = time(NULL); + struct tm *current_tm = localtime(¤t_time); + (void)strftime(part, sizeof(part), time_format, current_tm); + generate(ORDER_TIME, "time", part); + } else { + generate(ORDER_TIME, "time", ""); + } } }