From 5fd456ff7c87577b73a8eede5b05a09206b103cd Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 13 Jan 2013 22:05:58 +0000 Subject: [PATCH] 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. --- code/qcommon/files.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 5dffc06f..aa7dde8f 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -1360,10 +1360,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; + } } /*