Browse Source

System types like the string doesn't have a module information. Now the function is checking if is loaded to not raise any error.

Henrique Gottardi Werlang 2 months ago
parent
commit
a9f23105b4
1 changed files with 4 additions and 1 deletions
  1. 4 1
      packages/rtl/src/rtti.pas

+ 4 - 1
packages/rtl/src/rtti.pas

@@ -2473,7 +2473,10 @@ end;
 
 function TRttiType.GetDeclaringUnitName: String;
 begin
-  Result := Handle.Module.Name;
+  if Assigned(Handle.Module) then
+    Result := Handle.Module.Name
+  else
+    Result := 'System';
 end;
 
 function TRttiType.GetQualifiedName: String;