ref: 958c1774975d7239b0752eed92bd323cb0d4e877
parent: 4675a2d0c337fef404d6be5a824a8c4de4701e6e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Jul 24 22:12:55 EDT 2024
unix: don't crash if gmtime returns nil
--- a/unix/otfsys.c
+++ b/unix/otfsys.c
@@ -33,7 +33,9 @@
static char buf[32];
time_t t = v;
struct tm *tm;
- tm = gmtime(&t);
- strftime(buf, sizeof(buf), "%c", tm);
+
+ buf[0] = 0;
+ if((tm = gmtime(&t)) != nil)
+ strftime(buf, sizeof(buf), "%c", tm);
return buf;
}