summaryrefslogtreecommitdiff
path: root/src/cgame/cg_ptr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame/cg_ptr.c')
-rw-r--r--src/cgame/cg_ptr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cgame/cg_ptr.c b/src/cgame/cg_ptr.c
index 18810878..b5fa548e 100644
--- a/src/cgame/cg_ptr.c
+++ b/src/cgame/cg_ptr.c
@@ -42,12 +42,15 @@ int CG_ReadPTRCode( void )
// load the file
len = trap_FS_FOpenFile( PTRC_FILE, &f, FS_READ );
- if( len <= 0 )
+ if( len < 0 )
return 0;
// should never happen - malformed write
- if( len >= sizeof( text ) - 1 )
+ if( len == 0 || len >= sizeof( text ) - 1 )
+ {
+ trap_FS_FCloseFile( f );
return 0;
+ }
trap_FS_Read( text, len, f );
text[ len ] = 0;