From 53f0b22d699218be55ff009cda6415ac2bc0980a Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 09:52:30 +0000 Subject: [PATCH] W3DWater: Add null check for m_skyBox before replacing texture --- .../Source/W3DDevice/GameClient/Water/W3DWater.cpp | 5 ++++- .../Source/W3DDevice/GameClient/Water/W3DWater.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 784851861e8..d263b129047 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -1287,7 +1287,10 @@ void WaterRenderObjClass::replaceSkyboxTexture(const AsciiString& oldTexName, co { W3DAssetManager* assetManager = ((W3DAssetManager*)W3DAssetManager::Get_Instance()); - assetManager->replacePrototypeTexture(m_skyBox, oldTexName.str(), newTextName.str()); + if (m_skyBox) + { + assetManager->replacePrototypeTexture(m_skyBox, oldTexName.str(), newTextName.str()); + } //Enable clamping on all textures used by the skybox (to reduce corner seams). if (m_skyBox && m_skyBox->Class_ID() == RenderObjClass::CLASSID_MESH) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index e9599a7a256..dfe22e30bc8 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -1310,7 +1310,10 @@ void WaterRenderObjClass::replaceSkyboxTexture(const AsciiString& oldTexName, co { W3DAssetManager* assetManager = ((W3DAssetManager*)W3DAssetManager::Get_Instance()); - assetManager->replacePrototypeTexture(m_skyBox, oldTexName.str(), newTextName.str()); + if (m_skyBox) + { + assetManager->replacePrototypeTexture(m_skyBox, oldTexName.str(), newTextName.str()); + } //Enable clamping on all textures used by the skybox (to reduce corner seams). if (m_skyBox && m_skyBox->Class_ID() == RenderObjClass::CLASSID_MESH)