Sfoglia il codice sorgente

Fix for ToString when the object is nil.

Henrique Gottardi Werlang 1 anno fa
parent
commit
5b18d98cd1
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7 1
      packages/rtl/src/rtti.pas

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

@@ -1141,7 +1141,13 @@ begin
 
   case Kind of
     tkBool: Result := BoolToStr(AsBoolean, True);
-    tkClass: Result := AsObject.ClassName;
+    tkClass:
+    begin
+      if Assigned(AsObject) then
+        Result := AsObject.ClassName
+      else
+        Result := '(empty)';
+    end;
     tkClassRef: Result := AsClass.ClassName;
     tkEnumeration: Result := GetEnumName(TTypeInfoEnum(TypeInfo), AsOrdinal);
     tkFloat: Result := FloatToStr(AsExtended, AFormatSettings);