Browse Source

* Return delphi-compatible output for TValue.ToString when empty

Michaël Van Canneyt 1 year ago
parent
commit
9c5bfbeb78
1 changed files with 3 additions and 1 deletions
  1. 3 1
      packages/rtl-objpas/src/inc/rtti.pp

+ 3 - 1
packages/rtl-objpas/src/inc/rtti.pp

@@ -3984,6 +3984,8 @@ end;
 
 function TValue.ToString: String;
 begin
+  if IsEmpty then
+    Exit('(empty)');
   case Kind of
     tkWString,
     tkUString : result := AsUnicodeString;
@@ -4000,7 +4002,7 @@ begin
     tkChar: Result := AnsiChar(FData.FAsUByte);
     tkWChar: Result := UTF8Encode(WideChar(FData.FAsUWord));
   else
-    result := '';
+    result := '<unknown kind>';
   end;
 end;