fix: check gmtime, can return NULL on error

This commit is contained in:
Hiltjo Posthuma 2016-04-27 19:24:15 +02:00
parent 8df54926f2
commit 28730218c4
2 changed files with 4 additions and 2 deletions

View file

@ -49,7 +49,8 @@ printtimeformat(FILE *fp, const git_time *intime, const char *fmt)
char out[32];
t = (time_t) intime->time + (intime->offset * 60);
intm = gmtime(&t);
if (!(intm = gmtime(&t)))
return;
strftime(out, sizeof(out), fmt, intm);
fputs(out, fp);
}

View file

@ -190,7 +190,8 @@ printtimeformat(FILE *fp, const git_time *intime, const char *fmt)
char out[32];
t = (time_t) intime->time + (intime->offset * 60);
intm = gmtime(&t);
if (!(intm = gmtime(&t)))
return;
strftime(out, sizeof(out), fmt, intm);
fputs(out, fp);
}