Skip to content

Commit b3e27ad

Browse files
authored
Fix check of equality for Class objects (#2838)
1 parent cb5ce4f commit b3e27ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/CLR/Core/CLR_RT_HeapBlock.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,7 @@ bool CLR_RT_HeapBlock::ObjectsEqual(
13891389
if (leftClassTotFields > 0 && rightClassTotFields > 0 && leftClassTotFields == rightClassTotFields)
13901390
{
13911391
int equalFieldsCount = 0;
1392+
int totalFieldsCount = leftClassTotFields;
13921393

13931394
// loop through the fields and compare them
13941395
do
@@ -1404,7 +1405,7 @@ bool CLR_RT_HeapBlock::ObjectsEqual(
14041405
} while (--leftClassTotFields > 0);
14051406

14061407
// check if all fields are equal
1407-
return equalFieldsCount == leftClassTotFields;
1408+
return equalFieldsCount == totalFieldsCount;
14081409
}
14091410
}
14101411
}

0 commit comments

Comments
 (0)