From d5157aaf0babe5e8afe17460187ce0316780cf05 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 12 Jun 2017 17:37:05 -0700 Subject: [PATCH] r_part_fte: fix crashes on .bsp's with missing textures --- quakespasm/Quake/r_part_fte.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/r_part_fte.c b/quakespasm/Quake/r_part_fte.c index 6c42bbcb..4e247040 100644 --- a/quakespasm/Quake/r_part_fte.c +++ b/quakespasm/Quake/r_part_fte.c @@ -3565,6 +3565,8 @@ void PScript_RecalculateSkyTris (void) /*in quakespasm there are always two textures added on the end (rather than pointing to textures outside the model)*/ for (t = 0; t < m->numtextures-2; t++) { + if (!m->textures[t]) + continue; if (!q_strcasecmp(key+8, m->textures[t]->name)) remaps[t] = PScript_FindParticleType(com_token); } @@ -3576,7 +3578,10 @@ void PScript_RecalculateSkyTris (void) { ptype = remaps[t]; if (ptype == P_INVALID) - ptype = PScript_FindParticleType(va("tex_%s", m->textures[t]->name)); + { + if (m->textures[t]) + ptype = PScript_FindParticleType(va("tex_%s", m->textures[t]->name)); + } if (ptype >= 0) {