From 6c89a5adaea111fe906abef3be4e21578337875b Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 23:13:40 +0000 Subject: [PATCH] fix: Guard BodyModule access in StealthUpdate::allowedToStealth --- .../Source/GameLogic/Object/Update/StealthUpdate.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index 921f556612f..bfc8b972825 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -310,15 +310,17 @@ Bool StealthUpdate::allowedToStealth( Object *stealthOwner ) const return FALSE; } - if( flags & STEALTH_NOT_WHILE_TAKING_DAMAGE && self->getBodyModule()->getLastDamageTimestamp() >= now - 1 ) + BodyModuleInterface *body = self->getBodyModule(); + if( flags & STEALTH_NOT_WHILE_TAKING_DAMAGE && body && body->getLastDamageTimestamp() >= now - 1 ) { #if RETAIL_COMPATIBLE_CRC || PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR //Only if it's not healing damage. - if( self->getBodyModule()->getLastDamageInfo()->in.m_damageType != DAMAGE_HEALING ) + const DamageInfo *lastDamageInfo = body->getLastDamageInfo(); + if( lastDamageInfo && lastDamageInfo->in.m_damageType != DAMAGE_HEALING ) #endif { //Can't stealth if we just took damage in the last frame or two. - if( self->getBodyModule()->getLastDamageTimestamp() != 0xffffffff ) + if( body->getLastDamageTimestamp() != 0xffffffff ) { //But it's initialized to 0xffffffff so we don't think we took damage on the first frame. return FALSE;