diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index d28dfc805..c2f45ea10 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -1077,8 +1077,12 @@ void gl_RenderHUDModel(DPSprite *psp, float ofsX, float ofsY) bool gl_IsHUDModelForPlayerAvailable (player_t * player) { + if (player == nullptr || player->ReadyWeapon == nullptr) + return false; + DPSprite *psp = player->FindPSprite(PSP_WEAPON); - if ( (player == nullptr) || (player->ReadyWeapon == nullptr) || (psp->GetState() == nullptr) ) + + if (psp == nullptr || psp->GetState() == nullptr) return false; FState* state = psp->GetState(); diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index eb154357f..447e6b78e 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -240,7 +240,7 @@ void GLSprite::Draw(int pass) secplane_t *lowplane = i == (*lightlist).Size() - 1 ? &bottomp : &(*lightlist)[i + 1].plane; int thislight = (*lightlist)[i].caster != NULL ? gl_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel; - int thisll = (byte)gl_CheckSpriteGlow(actor->Sector, thislight, actor->InterpolatedPosition(r_TicFracF)); + int thisll = actor == nullptr? thislight : (uint8_t)gl_CheckSpriteGlow(actor->Sector, thislight, actor->InterpolatedPosition(r_TicFracF)); FColormap thiscm; thiscm.FadeColor = Colormap.FadeColor;