uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 6c1720e328d2ed6d5e9ac0a6a84f57ac2d360d84
parent 60698c787a84f41cde79f7dbaacce7203254f7d9
Author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
Date:   Wed, 17 Nov 2021 14:14:38 +0100

datetime: don't crash if localtime failed

Diffstat:
Msrc/uxnemu.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -384,7 +384,10 @@ static Uint8 datetime_dei(Device *d, Uint8 port) { time_t seconds = time(NULL); + struct tm zt = {0}; struct tm *t = localtime(&seconds); + if(t == NULL) + t = &zt; switch(port) { case 0x0: return (t->tm_year + 1900) >> 8; case 0x1: return (t->tm_year + 1900);