mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Fix potential dereference of null pointer when calling polymost_bindPth()
git-svn-id: https://svn.eduke32.com/eduke32@7000 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8b2d546774
commit
2f3e78a4b8
1 changed files with 20 additions and 15 deletions
|
@ -3047,11 +3047,14 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
// just submit the geometry and don't mess with textures.
|
// just submit the geometry and don't mess with textures.
|
||||||
if (videoGetRenderMode() == REND_POLYMOST)
|
if (videoGetRenderMode() == REND_POLYMOST)
|
||||||
{
|
{
|
||||||
polymost_bindPth(pth);
|
if (pth)
|
||||||
|
{
|
||||||
|
polymost_bindPth(pth);
|
||||||
|
|
||||||
//POGOTODO: I could move this into bindPth
|
//POGOTODO: I could move this into bindPth
|
||||||
if (pth && !(pth->flags & PTH_INDEXED))
|
if (!(pth->flags & PTH_INDEXED))
|
||||||
polymost_usePaletteIndexing(false);
|
polymost_usePaletteIndexing(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (drawpoly_srepeat)
|
if (drawpoly_srepeat)
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||||
|
@ -3168,7 +3171,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
polytint_t const & tint = hictinting[globalpal];
|
polytint_t const & tint = hictinting[globalpal];
|
||||||
float shadeFactor = (pth->flags & PTH_INDEXED) &&
|
float shadeFactor = pth &&
|
||||||
|
(pth->flags & PTH_INDEXED) &&
|
||||||
r_usetileshades &&
|
r_usetileshades &&
|
||||||
!(globalflags & GLOBAL_NO_GL_TILESHADES) ? 1.f : getshadefactor(globalshade);
|
!(globalflags & GLOBAL_NO_GL_TILESHADES) ? 1.f : getshadefactor(globalshade);
|
||||||
pc[0] = (1.f-(tint.sr*(1.f/255.f)))*shadeFactor+(tint.sr*(1.f/255.f));
|
pc[0] = (1.f-(tint.sr*(1.f/255.f)))*shadeFactor+(tint.sr*(1.f/255.f));
|
||||||
|
@ -7476,15 +7480,16 @@ void polymost_fillpolygon(int32_t npoints)
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
pthtyp *pth = our_texcache_fetch(DAMETH_NOMASK | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0));
|
pthtyp *pth = our_texcache_fetch(DAMETH_NOMASK | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0));
|
||||||
polymost_bindPth(pth);
|
|
||||||
if (pth && !(pth->flags & PTH_INDEXED))
|
if (pth)
|
||||||
{
|
{
|
||||||
polymost_usePaletteIndexing(false);
|
polymost_bindPth(pth);
|
||||||
|
|
||||||
|
if (!(pth->flags & PTH_INDEXED))
|
||||||
|
polymost_usePaletteIndexing(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
polymost_updatePalette();
|
polymost_updatePalette();
|
||||||
}
|
|
||||||
|
|
||||||
float const f = getshadefactor(globalshade);
|
float const f = getshadefactor(globalshade);
|
||||||
|
|
||||||
|
@ -7555,15 +7560,15 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i
|
||||||
loadedhitile[wallnum>>3] |= (1<<(wallnum&7));
|
loadedhitile[wallnum>>3] |= (1<<(wallnum&7));
|
||||||
usehightile = ousehightile;
|
usehightile = ousehightile;
|
||||||
|
|
||||||
polymost_bindPth(pth);
|
if (pth)
|
||||||
if (pth && !(pth->flags & PTH_INDEXED))
|
|
||||||
{
|
{
|
||||||
polymost_usePaletteIndexing(false);
|
polymost_bindPth(pth);
|
||||||
|
|
||||||
|
if (!(pth->flags & PTH_INDEXED))
|
||||||
|
polymost_usePaletteIndexing(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
polymost_updatePalette();
|
polymost_updatePalette();
|
||||||
}
|
|
||||||
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue