]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
report invalid edicts when attempting to link them
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 22 Jun 2003 09:55:02 +0000 (09:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 22 Jun 2003 09:55:02 +0000 (09:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3092 d7cf8633-e32d-0410-b094-e92efae38249

world.c

diff --git a/world.c b/world.c
index 3193466952d9050b2cd6831339d17018f3a84efe..d30f9f34d076b1ba1dadda5f9a460c27c3bb0379 100644 (file)
--- a/world.c
+++ b/world.c
@@ -283,7 +283,10 @@ void SV_TouchAreaGrid(edict_t *ent)
 void SV_LinkEdict_AreaGrid(edict_t *ent)
 {
        areagrid_t *grid;
-       int igrid[3], igridmins[3], igridmaxs[3], gridnum;
+       int igrid[3], igridmins[3], igridmaxs[3], gridnum, entitynumber = NUM_FOR_EDICT(ent);
+
+       if (entitynumber <= 0 || entitynumber >= sv.max_edicts || EDICT_NUM(entitynumber) != ent)
+               Host_Error("SV_LinkEdict_AreaGrid: invalid edict %p (sv.edicts is %p, edict compared to sv.edicts is %i)\n", ent, sv.edicts, entitynumber);
 
        igridmins[0] = (int) ((ent->v->absmin[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
        igridmins[1] = (int) ((ent->v->absmin[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);