Skip to content

Commit d7bbe6b

Browse files
authored
[GEN][ZH] Prevent using uninitialized memory in PartitionData::updateCellsTouched() (#1134)
1 parent be7f0d4 commit d7bbe6b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,6 @@ void PartitionData::updateCellsTouched()
20392039

20402040

20412041
Object *obj = getObject();
2042-
DEBUG_ASSERTCRASH(obj != NULL || m_ghostObject != NULL, ("must be attached to an Object here 1"));
20432042

20442043
if (obj)
20452044
{
@@ -2060,6 +2059,11 @@ void PartitionData::updateCellsTouched()
20602059
majorRadius = m_ghostObject->getGeometryMajorRadius();
20612060
minorRadius = m_ghostObject->getGeometryMinorRadius();
20622061
}
2062+
else
2063+
{
2064+
DEBUG_CRASH(("must be attached to an Object here"));
2065+
return;
2066+
}
20632067

20642068
removeAllTouchedCells();
20652069
if (isSmall)

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,6 @@ void PartitionData::updateCellsTouched()
20432043

20442044

20452045
Object *obj = getObject();
2046-
DEBUG_ASSERTCRASH(obj != NULL || m_ghostObject != NULL, ("must be attached to an Object here 1"));
20472046

20482047
if (obj)
20492048
{
@@ -2064,6 +2063,11 @@ void PartitionData::updateCellsTouched()
20642063
majorRadius = m_ghostObject->getGeometryMajorRadius();
20652064
minorRadius = m_ghostObject->getGeometryMinorRadius();
20662065
}
2066+
else
2067+
{
2068+
DEBUG_CRASH(("must be attached to an Object here"));
2069+
return;
2070+
}
20672071

20682072
removeAllTouchedCells();
20692073
if (isSmall)

0 commit comments

Comments
 (0)