Skip to content

Commit cfc9ea6

Browse files
authored
[GEN][ZH] Add null pointer tests in AIUpdateInterface::privateCommandButtonObject(), privateGuardObject() (#973)
1 parent 148aa7f commit cfc9ea6

File tree

2 files changed

+8
-6
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update
  • Generals/Code/GameEngine/Source/GameLogic/Object/Update

2 files changed

+8
-6
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3881,6 +3881,9 @@ void AIUpdateInterface::privateGuardTunnelNetwork( GuardMode guardMode, CommandS
38813881
*/
38823882
void AIUpdateInterface::privateGuardObject( Object *objectToGuard, GuardMode guardMode, CommandSourceType cmdSource )
38833883
{
3884+
if (!objectToGuard)
3885+
return;
3886+
38843887
if (getObject()->isMobile() == FALSE)
38853888
return;
38863889

@@ -4657,10 +4660,8 @@ void AIUpdateInterface::privateCommandButtonPosition( const CommandButton *comma
46574660
// ------------------------------------------------------------------------------------------------
46584661
void AIUpdateInterface::privateCommandButtonObject( const CommandButton *commandButton, Object *obj, CommandSourceType cmdSource )
46594662
{
4660-
if( !commandButton )
4661-
{
4663+
if( !commandButton || !obj )
46624664
return;
4663-
}
46644665

46654666
if (getObject()->isKindOf(KINDOF_PROJECTILE))
46664667
return;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,6 +4100,9 @@ void AIUpdateInterface::privateGuardTunnelNetwork( GuardMode guardMode, CommandS
41004100
*/
41014101
void AIUpdateInterface::privateGuardObject( Object *objectToGuard, GuardMode guardMode, CommandSourceType cmdSource )
41024102
{
4103+
if (!objectToGuard)
4104+
return;
4105+
41034106
if (getObject()->isMobile() == FALSE)
41044107
return;
41054108

@@ -4936,10 +4939,8 @@ void AIUpdateInterface::privateCommandButtonPosition( const CommandButton *comma
49364939
// ------------------------------------------------------------------------------------------------
49374940
void AIUpdateInterface::privateCommandButtonObject( const CommandButton *commandButton, Object *obj, CommandSourceType cmdSource )
49384941
{
4939-
if( !commandButton )
4940-
{
4942+
if( !commandButton || !obj )
49414943
return;
4942-
}
49434944

49444945
if (getObject()->isKindOf(KINDOF_PROJECTILE))
49454946
return;

0 commit comments

Comments
 (0)