From 3a4b009d5468839902aee9ee3436558080cdd9d8 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 28 Sep 2009 14:47:36 +0000 Subject: [PATCH] when fixing vertex indexes, reject the map instead of segfaulting if vertex index 0 is invalid too git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9251 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model_brush.c b/model_brush.c index 03009ddf..790a28a7 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1980,6 +1980,9 @@ static void Mod_Q1BSP_LoadEdges(lump_t *l) if (out->v[0] >= loadmodel->brushq1.numvertexes || out->v[1] >= loadmodel->brushq1.numvertexes) { Con_Printf("Mod_Q1BSP_LoadEdges: %s has invalid vertex indices in edge %i (vertices %i %i >= numvertices %i)\n", loadmodel->name, i, out->v[0], out->v[1], loadmodel->brushq1.numvertexes); + if(!loadmodel->brushq1.numvertexes) + Host_Error("Mod_Q1BSP_LoadEdges: %s has edges but no vertexes, cannot fix\n", loadmodel->name); + out->v[0] = 0; out->v[1] = 0; } @@ -4467,6 +4470,8 @@ static void Mod_Q3BSP_LoadTriangles(lump_t *l) if (*out < 0 || *out >= loadmodel->brushq3.num_vertices) { Con_Printf("Mod_Q3BSP_LoadTriangles: invalid vertexindex %i (%i vertices), setting to 0\n", *out, loadmodel->brushq3.num_vertices); + if(!loadmodel->brushq3.num_vertices) + Host_Error("Mod_Q1BSP_LoadTrianglles: %s has triangles but no vertexes, cannot fix\n", loadmodel->name); *out = 0; } } -- 2.39.2