Browse Source

rtl: fixed TRttiStructuredType.GetProperty case insensitive, issue 39230

mattias 3 years ago
parent
commit
600c131157
1 changed files with 4 additions and 1 deletions
  1. 4 1
      packages/rtl/rtti.pas

+ 4 - 1
packages/rtl/rtti.pas

@@ -1082,11 +1082,14 @@ end;
 function TRttiStructuredType.GetProperty(const AName: string): TRttiProperty;
 function TRttiStructuredType.GetProperty(const AName: string): TRttiProperty;
 var
 var
   Prop: TRttiProperty;
   Prop: TRttiProperty;
+  lName: String;
 
 
 begin
 begin
+  lName := LowerCase(AName);
   for Prop in GetProperties do
   for Prop in GetProperties do
-    if Prop.Name = AName then
+    if lowercase(Prop.Name) = lName then
       Exit(Prop);
       Exit(Prop);
+  Result:=nil;
 end;
 end;
 
 
 function TRttiStructuredType.GetDeclaredProperties: TRttiPropertyArray;
 function TRttiStructuredType.GetDeclaredProperties: TRttiPropertyArray;