diff options
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 7 | ||||
-rw-r--r-- | source/creator/creator.c | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e2876317e38..01a71cfd63d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7932,7 +7932,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) char build_commit_datetime[32]; time_t temp_time = main->build_commit_timestamp; struct tm *tm = gmtime(&temp_time); - strftime(build_commit_datetime, sizeof(build_commit_datetime), "%Y-%m-%d %H:%M", tm); + if (LIKELY(tm)) { + strftime(build_commit_datetime, sizeof(build_commit_datetime), "%Y-%m-%d %H:%M", tm); + } + else { + BLI_strncpy(build_commit_datetime, "date-unknown", sizeof(build_commit_datetime)); + } printf("read file %s\n Version %d sub %d date %s hash %s\n", fd->relabase, main->versionfile, main->subversionfile, 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 |