diff --git a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp index 65607038b2c..59ddaedc8cc 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -174,6 +174,13 @@ void Thing::setPositionZ( Real z ) //============================================================================= void Thing::setPosition( const Coord3D *pos ) { + // Validate position pointer to prevent null pointer dereference + if( pos == NULL ) + { + DEBUG_CRASH(( "Thing::setPosition called with NULL position pointer" )); + return; + } + //USE_PERF_TIMER(ThingMatrixStuff) if( !m_template->isKindOf( KINDOF_STICK_TO_TERRAIN_SLOPE) ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 4d164ee5775..7556f59ac8f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -434,6 +434,10 @@ void SpecialPowerModule::triggerSpecialPower( const Coord3D *location ) //------------------------------------------------------------------------------------------------- void SpecialPowerModule::createViewObject( const Coord3D *location ) { + // Validate location pointer to prevent null pointer dereference + if( location == NULL ) + return; + const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); const SpecialPowerTemplate *powerTemplate = modData->m_specialPowerTemplate; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp index 1deba83a7bb..ff1060f2710 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Thing.cpp @@ -174,6 +174,13 @@ void Thing::setPositionZ( Real z ) //============================================================================= void Thing::setPosition( const Coord3D *pos ) { + // Validate position pointer to prevent null pointer dereference + if( pos == NULL ) + { + DEBUG_CRASH(( "Thing::setPosition called with NULL position pointer" )); + return; + } + //USE_PERF_TIMER(ThingMatrixStuff) if( !m_template->isKindOf( KINDOF_STICK_TO_TERRAIN_SLOPE) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index e5213921df3..27e39e56889 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -493,6 +493,10 @@ void SpecialPowerModule::triggerSpecialPower( const Coord3D *location ) //------------------------------------------------------------------------------------------------- void SpecialPowerModule::createViewObject( const Coord3D *location ) { + // Validate location pointer to prevent null pointer dereference + if( location == NULL ) + return; + const SpecialPowerModuleData *modData = getSpecialPowerModuleData(); const SpecialPowerTemplate *powerTemplate = modData->m_specialPowerTemplate;