Skip to content

Commit

Permalink
Fix undefined behavior when rendering without a shadow node
Browse files Browse the repository at this point in the history
This bug was likely harmless but better be safe than sorry
  • Loading branch information
darksylinc committed Sep 17, 2021
1 parent f066fb7 commit c2cb032
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ THE SOFTWARE.

namespace Ogre
{
static const TextureGpuVec c_emptyTextureContainer;

const IdString PbsProperty::useLightBuffers = IdString("use_light_buffers");

const IdString PbsProperty::HwGammaRead = IdString( "hw_gamma_read" );
Expand Down Expand Up @@ -1852,7 +1854,8 @@ namespace Ogre
*passBufferPtr++ = (float)viewMatrix[0][i];

size_t shadowMapTexIdx = 0;
const TextureGpuVec &contiguousShadowMapTex = shadowNode->getContiguousShadowMapTex();
const TextureGpuVec &contiguousShadowMapTex =
shadowNode ? shadowNode->getContiguousShadowMapTex() : c_emptyTextureContainer;

for( int32 i=0; i<numShadowMapLights; ++i )
{
Expand Down

0 comments on commit c2cb032

Please sign in to comment.