mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 10:19:17 +02:00
* Make GetEnumName safer, check actual type. Allow passing an integer
This commit is contained in:
parent
46508f6af1
commit
cde58d66fc
@ -1479,7 +1479,7 @@ begin
|
|||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else if TypeInfo^.Kind=tkEnumeration then
|
||||||
begin
|
begin
|
||||||
PS:=@PT^.NameList;
|
PS:=@PT^.NameList;
|
||||||
dec(Value,PT^.MinValue);
|
dec(Value,PT^.MinValue);
|
||||||
@ -1489,7 +1489,11 @@ begin
|
|||||||
Dec(Value);
|
Dec(Value);
|
||||||
end;
|
end;
|
||||||
Result:=PS^;
|
Result:=PS^;
|
||||||
end;
|
end
|
||||||
|
else if TypeInfo^.Kind=tkInteger then
|
||||||
|
Result:=IntToStr(Value)
|
||||||
|
else
|
||||||
|
Result:='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user