Don't segfault when unable to open a file.

This commit is contained in:
Bill Currie 2010-09-19 17:04:03 +09:00
parent 25798e3c35
commit c85a0b2f25
2 changed files with 4 additions and 0 deletions

View File

@ -239,6 +239,8 @@ readMapFile
Sys_Printf ("loading %s\n", fname);
file = Qopen (fname, "rt");
if (!file)
return self;
size = Qfilesize (file);
dat = malloc (size + 1);
size = Qread (file, dat, size);

View File

@ -67,6 +67,8 @@ DisplayCmdOutput (void)
int size;
file = Qopen (FN_CMDOUT, "rt");
if (!file)
return;
size = Qfilesize (file);
buffer = malloc (size + 1);
size = Qread (file, buffer, size);