diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp index 8419869317b..388a4023ea9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp @@ -72,6 +72,10 @@ void MissileLauncherBuildingUpdate::switchToState(DoorStateType dst) return; const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); + + // Safety check: if the module data has been cleared during destruction, don't proceed + if (!d) + return; ModelConditionFlags clr, set; UnsignedInt now = TheGameLogic->getFrame(); switch (dst) @@ -229,6 +233,10 @@ UpdateSleepTime MissileLauncherBuildingUpdate::update( void ) return UPDATE_SLEEP_NONE; const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); + + // Safety check: if the module data has been cleared during destruction, don't proceed + if (!d) + return UPDATE_SLEEP_NONE; UnsignedInt now = TheGameLogic->getFrame(); @@ -275,6 +283,11 @@ UpdateSleepTime MissileLauncherBuildingUpdate::update( void ) SpecialPowerTemplate* MissileLauncherBuildingUpdate::getTemplate() const { const MissileLauncherBuildingUpdateModuleData* data = getMissileLauncherBuildingUpdateModuleData(); + + // Safety check: if the module data has been cleared during destruction, return NULL + if (!data) + return NULL; + return data->m_specialPowerTemplate; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp index fd0d04ad8e3..d50f8fbec8e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp @@ -73,6 +73,10 @@ void MissileLauncherBuildingUpdate::switchToState(DoorStateType dst) return; const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); + + // Safety check: if the module data has been cleared during destruction, don't proceed + if (!d) + return; ModelConditionFlags clr, set; UnsignedInt now = TheGameLogic->getFrame(); switch (dst) @@ -245,6 +249,10 @@ UpdateSleepTime MissileLauncherBuildingUpdate::update( void ) return UPDATE_SLEEP_NONE; const MissileLauncherBuildingUpdateModuleData* d = getMissileLauncherBuildingUpdateModuleData(); + + // Safety check: if the module data has been cleared during destruction, don't proceed + if (!d) + return UPDATE_SLEEP_NONE; UnsignedInt now = TheGameLogic->getFrame(); @@ -291,6 +299,11 @@ UpdateSleepTime MissileLauncherBuildingUpdate::update( void ) SpecialPowerTemplate* MissileLauncherBuildingUpdate::getTemplate() const { const MissileLauncherBuildingUpdateModuleData* data = getMissileLauncherBuildingUpdateModuleData(); + + // Safety check: if the module data has been cleared during destruction, return NULL + if (!data) + return NULL; + return data->m_specialPowerTemplate; }