From 801fbddd475b7c620fd9d3fd4221629da2b7047a Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 2 Aug 2017 01:41:48 +0200 Subject: [PATCH] - Fix gcc compile error - Fix weapon null pointer crash --- src/gl/scene/gl_spritelight.cpp | 4 ++-- src/gl/scene/gl_weapon.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index fa43185353..0eba9249b6 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -148,7 +148,7 @@ static bool CheckBBoxCircle(float *bbox, float x, float y, float radiusSquared) } template -void BSPNodeWalkCircle(void *node, float x, float y, float radiusSquared, Callback &callback) +void BSPNodeWalkCircle(void *node, float x, float y, float radiusSquared, const Callback &callback) { while (!((size_t)node & 1)) { @@ -168,7 +168,7 @@ void BSPNodeWalkCircle(void *node, float x, float y, float radiusSquared, Callba } template -void BSPWalkCircle(float x, float y, float radiusSquared, Callback &callback) +void BSPWalkCircle(float x, float y, float radiusSquared, const Callback &callback) { if (level.nodes.Size() == 0) callback(&level.subsectors[0]); diff --git a/src/gl/scene/gl_weapon.cpp b/src/gl/scene/gl_weapon.cpp index 548078bed8..551f34cbdd 100644 --- a/src/gl/scene/gl_weapon.cpp +++ b/src/gl/scene/gl_weapon.cpp @@ -420,7 +420,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep) { if (gl_lights && GLRenderer->mLightCount && FixedColormap == CM_DEFAULT && gl_light_sprites) { - FSpriteModelFrame *smf = gl_FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->GetState()->sprite, psp->GetState()->GetFrame(), false); + FSpriteModelFrame *smf = playermo->player->ReadyWeapon ? gl_FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->GetState()->sprite, psp->GetState()->GetFrame(), false) : nullptr; if (smf) gl_SetDynModelLight(playermo, true); else