From 252e7cb2cc55846754ea67fa5ffc87b484786fe5 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 20:40:03 +0000 Subject: [PATCH] W3DParticleSys: Add null check for texture before rendering particles --- .../Source/W3DDevice/GameClient/W3DParticleSys.cpp | 4 ++++ .../Source/W3DDevice/GameClient/W3DParticleSys.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index f71bccd308b..a5a92ed40a8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -209,6 +209,10 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) TextureClass *texture = W3DDisplay::m_assetManager->Get_Texture( sys->getParticleTypeName().str() ); + // Skip rendering if texture is null or invalid (use-after-free protection) + if ( !texture ) + continue; + if ( m_streakLine && sys->isUsingStreak() && (count >= 2) ) { m_streakLine->Reset_Line(); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index 8920c2338d0..537509b40ac 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -248,6 +248,10 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) TextureClass *texture = W3DDisplay::m_assetManager->Get_Texture( sys->getParticleTypeName().str() ); + // Skip rendering if texture is null or invalid (use-after-free protection) + if ( !texture ) + continue; + if ( m_streakLine && sys->isUsingStreak() && (count >= 2) ) { m_streakLine->Reset_Line();