]> git.sur5r.net Git - i3/i3status/commitdiff
Bugfix: Correctly terminate output if time is specified in order but no time_format...
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 18 Aug 2009 20:09:07 +0000 (22:09 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 18 Aug 2009 20:09:07 +0000 (22:09 +0200)
i3status.c

index 04fa57f8ef53e0382a98c6f3635695b2f1171639..37e6639e2401a6de0d6887aee6eff69822eb2e90 100644 (file)
@@ -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(&current_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(&current_time);
+                                        (void)strftime(part, sizeof(part), time_format, current_tm);
+                                        generate(ORDER_TIME, "time", part);
+                                } else {
+                                        generate(ORDER_TIME, "time", "");
+                                }
                         }
                 }