History

unix: don't crash if gmtime returns nil

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit 958c1771 parent 4675a2d1 file · +4 −2Browse files

Unified · Split

unix/otfsys.c+4−2
@@ -33,7 +33,9 @@ fmttime(long long v) · 32 unmodified lines
33 static char buf[32];33 static char buf[32];
34 time_t t = v;34 time_t t = v;
35 struct tm *tm;35 struct tm *tm;
36 tm = gmtime(&t);36
37 strftime(buf, sizeof(buf), "%c", tm);37 buf[0] = 0;
38 if((tm = gmtime(&t)) != nil)
39 strftime(buf, sizeof(buf), "%c", tm);
38 return buf;40 return buf;
39}41}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t