Merge branch 'fix-masked-seg-crash' into 'next'

Fix a possible crash in R_RenderMaskedSegRange

See merge request STJr/SRB2!2121
This commit is contained in:
Sal 2023-08-23 04:31:23 +00:00
commit 3943a48a06

View file

@ -1487,6 +1487,9 @@ static void R_AllocClippingTables(size_t range)
openings = Z_Realloc(openings, numopenings * sizeof (*openings), PU_STATIC, NULL);
lastopening = openings + pos;
if (oldopenings == NULL)
return;
// borrowed fix from *cough* zdoom *cough*
// [RH] We also need to adjust the openings pointers that
// 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);
curtexturecolumntable = texturecolumntable + pos;
if (oldtable == NULL)
return;
for (drawseg_t *ds = drawsegs; ds < ds_p; ds++)
{
// Check if it's in range of the tables