From 9cbda81a19cc93fe37c49ac3ed1b2b21fc7b1c4a Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:26:10 +0000 Subject: [PATCH] bugfix(rts): Prevent common attack target from being a destroyed object --- Generals/Code/GameEngine/Source/Common/RTS/Team.cpp | 3 +++ GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index c9016d189ad..582f4cdb923 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1518,6 +1518,9 @@ Object *Team::getTeamTargetObject() return nullptr; } Object *target = TheGameLogic->findObjectByID(m_commonAttackTarget); + if (target && target->isDestroyed()) { + target = nullptr; + } if (target) { //If the enemy unit is stealthed and not detected, then we can't attack it! if( target->testStatus( OBJECT_STATUS_STEALTHED ) && diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 30c8f077215..5d25a3b9e8f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -1519,6 +1519,9 @@ Object *Team::getTeamTargetObject() return nullptr; } Object *target = TheGameLogic->findObjectByID(m_commonAttackTarget); + if (target && target->isDestroyed()) { + target = nullptr; + } if (target) { //If the enemy unit is stealthed and not detected, then we can't attack it! if( target->testStatus( OBJECT_STATUS_STEALTHED ) &&