diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-17 19:39:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-17 19:41:28 +0400 |
commit | 84c30edbdfe00bc3b8f39504c4dff5ab607f3ece (patch) | |
tree | 0e7da21d1a68a8a90beee05f64665d62f46a2cb8 /source/creator/creator.c | |
parent | b764fe58c575c7c9343f635cc0cf7836c2a4e14b (diff) |
fix for crash with new buildinfo, when gmtime() returns NULL
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r-- | source/creator/creator.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 508847af5e3..adedab80338 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1516,8 +1516,15 @@ int main(int argc, const char **argv) { time_t temp_time = build_commit_timestamp; struct tm *tm = gmtime(&temp_time); - strftime(build_commit_date, sizeof(build_commit_date), "%Y-%m-%d", tm); - strftime(build_commit_time, sizeof(build_commit_time), "%H:%M", tm); + if (LIKELY(tm)) { + strftime(build_commit_date, sizeof(build_commit_date), "%Y-%m-%d", tm); + strftime(build_commit_time, sizeof(build_commit_time), "%H:%M", tm); + } + else { + const char *unknown = "date-unknown"; + BLI_strncpy(build_commit_date, unknown, sizeof(build_commit_date)); + BLI_strncpy(build_commit_time, unknown, sizeof(build_commit_time)); + } } #endif |