Simulator - show date, also add NULL checks

This commit is contained in:
Tester23
2024-04-03 09:16:13 +02:00
parent db331fb6e4
commit 403152bf08
3 changed files with 33 additions and 8 deletions

View File

@@ -169,8 +169,10 @@ char *FS_ReadTextFile(const char *fname) {
int len = ftell(f);
fseek(f, 0, SEEK_SET);
char *r = (char*)malloc(len + 1);
fread(r, 1, len, f);
r[len] = 0;
if (r) {
fread(r, 1, len, f);
r[len] = 0;
}
fclose(f);
return r;
}