set currenttex to null if it gets an invalid texture id

This commit is contained in:
Alug committed 2024-02-20 18:06:10 +01:00
1 parent b02f0fc771
commit 7deff2bfaa
1 file changed
+9 -2
+9 -2
View File
@@ -562,10 +562,17 @@ void HWR_LoadTextures(size_t pnumtextures)
GLMapTexture_t *HWR_GetTexture(INT32 tex)
{
GLMapTexture_t *grtex;
if (tex < 0 || tex >= (signed)gr_numtextures)
{
#ifdef PARANOIA
if ((unsigned)tex >= gr_numtextures)
I_Error("HWR_GetTexture: tex >= numtextures\n");
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
#else
HWR_SetCurrentTexture(NULL);
return NULL;
#endif
}
grtex = &gr_textures[tex];
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)