mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-28 23:21:58 +00:00
Fix a possible crash in R_RenderMaskedSegRange
R_AllocTextureColumnTables wasn't checking if the tables were never allocated, making the renderer later attempt to render midtextures for drawsegs that don't contain actual midtextures.
This commit is contained in:
parent
ac3e9fc999
commit
55b4458001
1 changed files with 6 additions and 0 deletions
|
@ -1487,6 +1487,9 @@ static void R_AllocClippingTables(size_t range)
|
||||||
openings = Z_Realloc(openings, numopenings * sizeof (*openings), PU_STATIC, NULL);
|
openings = Z_Realloc(openings, numopenings * sizeof (*openings), PU_STATIC, NULL);
|
||||||
lastopening = openings + pos;
|
lastopening = openings + pos;
|
||||||
|
|
||||||
|
if (oldopenings == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
// borrowed fix from *cough* zdoom *cough*
|
// borrowed fix from *cough* zdoom *cough*
|
||||||
// [RH] We also need to adjust the openings pointers that
|
// [RH] We also need to adjust the openings pointers that
|
||||||
// were already stored in drawsegs.
|
// were already stored in drawsegs.
|
||||||
|
@ -1519,6 +1522,9 @@ static void R_AllocTextureColumnTables(size_t range)
|
||||||
texturecolumntable = Z_Realloc(texturecolumntable, texturecolumntablesize * sizeof (*texturecolumntable), PU_STATIC, NULL);
|
texturecolumntable = Z_Realloc(texturecolumntable, texturecolumntablesize * sizeof (*texturecolumntable), PU_STATIC, NULL);
|
||||||
curtexturecolumntable = texturecolumntable + pos;
|
curtexturecolumntable = texturecolumntable + pos;
|
||||||
|
|
||||||
|
if (oldtable == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
for (drawseg_t *ds = drawsegs; ds < ds_p; ds++)
|
for (drawseg_t *ds = drawsegs; ds < ds_p; ds++)
|
||||||
{
|
{
|
||||||
// Check if it's in range of the tables
|
// Check if it's in range of the tables
|
||||||
|
|
Loading…
Reference in a new issue