diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2009-08-18 22:09:07 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2009-08-18 22:09:07 +0200 |
commit | 39b153fdd100088b567130a354824ef49b190009 (patch) | |
tree | e339f02ea771383b5c953659042f62c918dd59cf /i3status.c | |
parent | bb52b40c8ed5b3c938f6bb157b08bcb18bb067c2 (diff) |
Bugfix: Correctly terminate output if time is specified in order but no time_format given (Thanks XTaran)
Diffstat (limited to 'i3status.c')
-rw-r--r-- | i3status.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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", ""); + } } } |