From 97a3d9fc989eccece0d7b730473762180cecfab1 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 12 Apr 2011 20:05:04 +0000 Subject: [PATCH] avoid some crashes when recursing BIHs git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11054 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- 2.39.2