fixed RB_RenderLitSurfList still crashing because of an invalid stage index

the first attempt was f99c223495
this is really not a proper fix since I haven't solved how it gets to that stage
but, knowing I will be deleting this whole part of the code soon enough anyway...
This commit is contained in:
myT 2022-06-17 03:26:36 +02:00
parent 928c9a71ec
commit 9895f3b895
1 changed files with 4 additions and 2 deletions

View File

@ -419,13 +419,15 @@ static void RB_RenderLitSurfList( dlight_t* dl, qbool opaque )
if (!opaque && shader->sort <= SS_OPAQUE)
continue;
const int stageIndex = shader->lightingStages[ST_DIFFUSE];
if (stageIndex < 0 || stageIndex >= shader->numStages)
continue;
if (shaderPrev)
RB_EndSurface();
RB_BeginSurface( shader, fogNum );
tess.greyscale = litSurf->greyscale;
// stage index is guaranteed valid by R_AddLitSurface
const int stageIndex = shader->lightingStages[ST_DIFFUSE];
const shaderStage_t* const stage = shader->stages[stageIndex];
backEnd.dlIntensity = (shader->contentFlags & liquidFlags) != 0 ? 0.5f : 1.0f;
backEnd.dlStateBits =