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();