Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): a power fired with no target makes no view object

Olcay Seygan5a201129c4fc
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
index 948a59810..b9f07a078 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
@@ -540,6 +540,10 @@ void SpecialPowerModule::createViewObject( const Coord3D *location )
if( visionRange == 0 || visionDuration == 0 )
return; // We don't want a view object at all.
+ // A no-target power (doSpecialPower, a script's command button) has no place to reveal.
+ if( location == NULL )
+ return;
+
AsciiString objectName = TheGlobalData->m_specialPowerViewObjectName;
if( objectName.isEmpty() )
return;