From 42070547099ff21efd19df2519db401b16b76fbb Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 10 Apr 2016 19:34:57 -0600 Subject: [PATCH] light: avoid crash if no textures in bsp --- light/entities.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/light/entities.c b/light/entities.c index 342dd1dc..aad109b3 100644 --- a/light/entities.c +++ b/light/entities.c @@ -1559,6 +1559,11 @@ static void MakeSurfaceLights(const bsp2_t *bsp) surf = &bsp->dfaces[facenum]; info = &bsp->texinfo[surf->texinfo]; + + /* Don't crash if there are no textuers */ + if (!bsp->texdatasize) + continue; + ofs = bsp->dtexdata.header->dataofs[info->miptex]; miptex = (const miptex_t *)(bsp->dtexdata.base + ofs); face_modelinfo = ModelInfoForFace(bsp, facenum); @@ -1568,6 +1573,7 @@ static void MakeSurfaceLights(const bsp2_t *bsp) continue; /* Ignore the underwater side of liquid surfaces */ + // FIXME: Use a Face_TextureName function for this if (miptex->name[0] == '*' && underwater) continue;