Skip to content

Commit 8a87098

Browse files
committed
[GEN][ZH] Prevent dereferencing NULL pointer 'that' in PhysicsBehavior::transferVelocityTo()
1 parent 6026f2c commit 8a87098

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,10 @@ void PhysicsBehavior::addOverlap(Object *obj)
942942
void PhysicsBehavior::transferVelocityTo(PhysicsBehavior* that) const
943943
{
944944
if (that != NULL)
945+
{
945946
that->m_vel.add(&m_vel);
946-
that->m_velMag = INVALID_VEL_MAG;
947+
that->m_velMag = INVALID_VEL_MAG;
948+
}
947949
}
948950

949951
//-------------------------------------------------------------------------------------------------

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,10 @@ void PhysicsBehavior::addOverlap(Object *obj)
10671067
void PhysicsBehavior::transferVelocityTo(PhysicsBehavior* that) const
10681068
{
10691069
if (that != NULL)
1070+
{
10701071
that->m_vel.add(&m_vel);
1071-
that->m_velMag = INVALID_VEL_MAG;
1072+
that->m_velMag = INVALID_VEL_MAG;
1073+
}
10721074
}
10731075

10741076
//-------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)