aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/date.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/date.c b/toys/posix/date.c
index ead72e15..86c2d343 100644
--- a/toys/posix/date.c
+++ b/toys/posix/date.c
@@ -138,7 +138,7 @@ void date_main(void)
if (FLAG(I)) {
char *iso_formats[] = {"%F","%FT%H%:z","%FT%R%:z","%FT%T%:z","%FT%T,%N%:z"};
- int i = stridx("dhmsn", *TT.I ? *TT.I : 'd');
+ int i = stridx("dhmsn", (TT.I && *TT.I) ? *TT.I : 'd');
if (i<0) help_exit("bad -I: %s", TT.I);
format_string = xstrdup(iso_formats[i]);