From: havoc Date: Mon, 3 Dec 2007 11:50:15 +0000 (+0000) Subject: fix crash on entities with missing models (bug introduced by div0) X-Git-Tag: xonotic-v0.1.0preview~2729 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ed3f1b3adcfabfec79650875f5307ddac5555878;p=xonotic%2Fdarkplaces.git fix crash on entities with missing models (bug introduced by div0) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7758 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 57b95387..04c2bbd7 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2191,7 +2191,7 @@ static void R_View_UpdateEntityVisible (void) for (i = 0;i < r_refdef.numentities;i++) { ent = r_refdef.entities[i]; - r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)) && ((ent->effects & EF_NODEPTHTEST) || (ent->flags & RENDER_VIEWMODEL) || r_refdef.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.worldmodel, r_viewcache.world_leafvisible, ent->mins, ent->maxs)); + r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model && ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)) && ((ent->effects & EF_NODEPTHTEST) || (ent->flags & RENDER_VIEWMODEL) || r_refdef.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.worldmodel, r_viewcache.world_leafvisible, ent->mins, ent->maxs)); } if(r_cullentities_trace.integer) @@ -2215,7 +2215,7 @@ static void R_View_UpdateEntityVisible (void) for (i = 0;i < r_refdef.numentities;i++) { ent = r_refdef.entities[i]; - r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)); + r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model && ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)); } }