fix: check gmtime, can return NULL on error
This commit is contained in:
parent
8df54926f2
commit
28730218c4
2 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
3
stagit.c
3
stagit.c
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue