From: divverent Date: Tue, 12 Apr 2011 20:05:04 +0000 (+0000) Subject: avoid some crashes when recursing BIHs X-Git-Tag: xonotic-v0.6.0~163^2~492 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=97a3d9fc989eccece0d7b730473762180cecfab1;p=xonotic%2Fdarkplaces.git avoid some crashes when recursing BIHs git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11054 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index 37285c6b..1051d280 100644 --- a/model_brush.c +++ b/model_brush.c @@ -5991,6 +5991,9 @@ void Mod_CollisionBIH_TracePoint(dp_model_t *model, const frameblend_t *frameble trace->hitsupercontentsmask = hitsupercontentsmask; bih = &model->collision_bih; + if(!bih->nodes) + return; + nodenum = bih->rootnode; nodestack[nodestackpos++] = nodenum; while (nodestackpos) @@ -6047,6 +6050,9 @@ void Mod_CollisionBIH_TraceLineShared(dp_model_t *model, const frameblend_t *fra vec_t d1, d2, d3, d4, f, nodestackline[1024][6]; int axis, nodenum, nodestackpos = 0, nodestack[1024]; + if(!bih->nodes) + return; + if (VectorCompare(start, end)) { Mod_CollisionBIH_TracePoint(model, frameblend, skeleton, trace, start, hitsupercontentsmask); @@ -6180,6 +6186,8 @@ void Mod_CollisionBIH_TraceBrush(dp_model_t *model, const frameblend_t *frameble } bih = &model->collision_bih; + if(!bih->nodes) + return; nodenum = bih->rootnode; // box trace, performed as brush trace