Skip to content

Commit

Permalink
Added sanity check for matching class type of object/typeinfo #30
Browse files Browse the repository at this point in the history
  • Loading branch information
bero committed Dec 7, 2024
1 parent d47b191 commit 7421417
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/BoldSystem.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5089,6 +5089,9 @@ function TBoldObject.ValidateMember(const ObjectDelphiName, MemberDelphiName: St
if not assigned(self) then
InternalRaise(EBold, sValidate_MemberNotAssigned, [ObjectDelphiName, MemberDelphiName, ObjectDelphiName]);

if (self.ClassType <> BoldClassTypeInfo.ObjectClass) then
InternalRaise(EBold, 'Object class %s does not match the BoldClassTypeInfo %s.', [self.ClassType.ClassName, BoldClassTypeInfo.ObjectClass.ClassName]);

if Cardinal(GeneratedMemberIndex) >= Cardinal(BoldMemberCount) then
begin
MemberRTInfo := BoldClassTypeInfo.AllMembers.ItemsByDelphiName[MemberDelphiName] as TBoldMemberRTInfo;
Expand Down

0 comments on commit 7421417

Please sign in to comment.