fix a crash on edict_num(32767)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 29 Jan 2011 08:32:32 +0000 (08:32 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 29 Jan 2011 08:32:32 +0000 (08:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10777 d7cf8633-e32d-0410-b094-e92efae38249

prvm_cmds.c

index afe3422..01386fd 100644 (file)
@@ -874,7 +874,7 @@ void VM_ftoe(void)
        VM_SAFEPARMCOUNT(1, VM_ftoe);
 
        ent = (int)PRVM_G_FLOAT(OFS_PARM0);
-       if (ent < 0 || ent >= MAX_EDICTS || PRVM_PROG_TO_EDICT(ent)->priv.required->free)
+       if (ent < 0 || ent >= prog->max_edicts || PRVM_PROG_TO_EDICT(ent)->priv.required->free)
                ent = 0; // return world instead of a free or invalid entity
 
        PRVM_G_INT(OFS_RETURN) = ent;