From 0661731a6752736f6e26e634dfbbeb538af556a9 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 03:07:03 +0000 Subject: [PATCH] MissileLauncherBuildingUpdate: Add safety check for destroyed objects --- .../Object/Update/MissileLauncherBuildingUpdate.cpp | 8 ++++++++ .../Object/Update/MissileLauncherBuildingUpdate.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp index e3eb7351efa..8419869317b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp @@ -67,6 +67,10 @@ void MissileLauncherBuildingUpdate::switchToState(DoorStateType dst) if (m_doorState == dst) return; + // Safety check: if the object has been destroyed, don't attempt state changes + if (!getObject()) + return; + const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); ModelConditionFlags clr, set; UnsignedInt now = TheGameLogic->getFrame(); @@ -220,6 +224,10 @@ Bool MissileLauncherBuildingUpdate::isPowerCurrentlyInUse( const CommandButton * //------------------------------------------------------------------------------------------------- UpdateSleepTime MissileLauncherBuildingUpdate::update( void ) { + // Safety check: if the object has been destroyed, don't update + if (!getObject()) + return UPDATE_SLEEP_NONE; + const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); UnsignedInt now = TheGameLogic->getFrame(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp index e1c641345f3..fd0d04ad8e3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp @@ -68,6 +68,10 @@ void MissileLauncherBuildingUpdate::switchToState(DoorStateType dst) if (m_doorState == dst) return; + // Safety check: if the object has been destroyed, don't attempt state changes + if (!getObject()) + return; + const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); ModelConditionFlags clr, set; UnsignedInt now = TheGameLogic->getFrame(); @@ -236,6 +240,10 @@ Bool MissileLauncherBuildingUpdate::isPowerCurrentlyInUse( const CommandButton * //------------------------------------------------------------------------------------------------- UpdateSleepTime MissileLauncherBuildingUpdate::update( void ) { + // Safety check: if the object has been destroyed, don't update + if (!getObject()) + return UPDATE_SLEEP_NONE; + const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); UnsignedInt now = TheGameLogic->getFrame();