summaryrefslogtreecommitdiff
path: root/src/game/bg_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/bg_misc.c')
-rw-r--r--src/game/bg_misc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 8f03f098..6c63d648 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -1455,12 +1455,14 @@ static qboolean BG_ParseBuildableFile( const char *filename, buildableAttributeO
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
+ if( len < 0 )
return qfalse;
- if( len >= sizeof( text ) - 1 )
+ if( len == 0 || len >= sizeof( text ) - 1 )
{
- Com_Printf( S_COLOR_RED "ERROR: Buildable file %s too long\n", filename );
+ trap_FS_FCloseFile( f );
+ Com_Printf( S_COLOR_RED "ERROR: Buildable file %s is %s\n", filename,
+ len == 0 ? "empty" : "too long" );
return qfalse;
}
@@ -2991,12 +2993,14 @@ static qboolean BG_ParseClassFile( const char *filename, classAttributeOverrides
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
+ if( len < 0 )
return qfalse;
- if( len >= sizeof( text ) - 1 )
+ if( len == 0 || len >= sizeof( text ) - 1 )
{
- Com_Printf( S_COLOR_RED "ERROR: Class file %s too long\n", filename );
+ trap_FS_FCloseFile( f );
+ Com_Printf( S_COLOR_RED "ERROR: Class file %s is %s\n", filename,
+ len == 0 ? "empty" : "too long" );
return qfalse;
}