From 7d41cd4ac2d30752e9acc37c23b072508fd9d90f Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Fri, 7 Oct 2022 11:13:01 -0300 Subject: [PATCH] More explicitly state pointer dependencies --- .../Hlms/Pbs/src/Cubemaps/OgreCubemapProbe.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Components/Hlms/Pbs/src/Cubemaps/OgreCubemapProbe.cpp b/Components/Hlms/Pbs/src/Cubemaps/OgreCubemapProbe.cpp index 4bc78e60aed..22c246985dc 100644 --- a/Components/Hlms/Pbs/src/Cubemaps/OgreCubemapProbe.cpp +++ b/Components/Hlms/Pbs/src/Cubemaps/OgreCubemapProbe.cpp @@ -115,14 +115,15 @@ namespace Ogre { if( !mCreator->getAutomaticMode() ) { - if( mTexture ) + // A Workspace without a valid texture is never valid. If it happens it + // could mean the workspace is internally referencing a dangling pointer. + OGRE_ASSERT_LOW( mTexture ); + + const bool useManual = mTexture->getNumMipmaps() > 1u; + if( useManual ) { - const bool useManual = mTexture->getNumMipmaps() > 1u; - if( useManual ) - { - TextureGpu *channel = mWorkspace->getExternalRenderTargets()[0]; - mCreator->releaseTmpRtt( channel ); - } + TextureGpu *channel = mWorkspace->getExternalRenderTargets()[0]; + mCreator->releaseTmpRtt( channel ); } }