diff options
author | Tim Angus <tim@ngus.net> | 2013-01-13 22:05:58 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-13 23:00:11 +0000 |
commit | 67da4df55171e3dd15465cf55d7a6d9f5282fcb2 (patch) | |
tree | b966ca8541d6b6d100de6776d556c989db8e6caf /src/qcommon | |
parent | 814463e1dc1b94baff40e1c795af5588014456bd (diff) |
Fix FS_FOpenFileRead corner case
FS_FOpenFileRead is a fairly mental function that changes its return
behaviour depending on whether or not file is NULL or not. It turns out
in the case where file is NULL, we were returning the wrong value when
the file didn't exist.
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/files.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/qcommon/files.c b/src/qcommon/files.c index a71c9b70..4e1aef13 100644 --- a/src/qcommon/files.c +++ b/src/qcommon/files.c @@ -1322,10 +1322,17 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF fprintf(missingFiles, "%s\n", filename); #endif - if(file) - *file = 0; - - return -1; + if(file) + { + *file = 0; + return -1; + } + else + { + // When file is NULL, we're querying the existance of the file + // If we've got here, it doesn't exist + return 0; + } } /* |