From ee7cc051c3ef18b9cc610fec2cf127e2249a62f9 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 22 Jun 2003 09:55:02 +0000 Subject: [PATCH] report invalid edicts when attempting to link them git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3092 d7cf8633-e32d-0410-b094-e92efae38249 --- world.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/world.c b/world.c index 31934669..d30f9f34 100644 --- 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]); -- 2.39.2