mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Don't segfault when unable to open a file.
This commit is contained in:
parent
25798e3c35
commit
c85a0b2f25
2 changed files with 4 additions and 0 deletions
|
@ -239,6 +239,8 @@ readMapFile
|
||||||
Sys_Printf ("loading %s\n", fname);
|
Sys_Printf ("loading %s\n", fname);
|
||||||
|
|
||||||
file = Qopen (fname, "rt");
|
file = Qopen (fname, "rt");
|
||||||
|
if (!file)
|
||||||
|
return self;
|
||||||
size = Qfilesize (file);
|
size = Qfilesize (file);
|
||||||
dat = malloc (size + 1);
|
dat = malloc (size + 1);
|
||||||
size = Qread (file, dat, size);
|
size = Qread (file, dat, size);
|
||||||
|
|
|
@ -67,6 +67,8 @@ DisplayCmdOutput (void)
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
file = Qopen (FN_CMDOUT, "rt");
|
file = Qopen (FN_CMDOUT, "rt");
|
||||||
|
if (!file)
|
||||||
|
return;
|
||||||
size = Qfilesize (file);
|
size = Qfilesize (file);
|
||||||
buffer = malloc (size + 1);
|
buffer = malloc (size + 1);
|
||||||
size = Qread (file, buffer, size);
|
size = Qread (file, buffer, size);
|
||||||
|
|
Loading…
Reference in a new issue