mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 20:21:20 +02:00
IdeIntf: Prevent bogus entries with a non-contiguous enum in TEnumPropertyEditor. Issue #39832.
(cherry picked from commit 686b056fcf
)
This commit is contained in:
parent
cd997e0308
commit
cd3d8a368b
@ -3836,7 +3836,8 @@ begin
|
||||
L := OrdValue;
|
||||
TypeData := GetTypeData(GetPropType);
|
||||
with TypeData^ do
|
||||
if (L < MinValue) or (L > MaxValue) then L := MaxValue;
|
||||
if (L < MinValue) or (L > MaxValue) then
|
||||
L := MaxValue;
|
||||
Result := GetEnumName(GetPropType, L);
|
||||
end;
|
||||
|
||||
@ -3852,13 +3853,17 @@ procedure TEnumPropertyEditor.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
EnumType: PTypeInfo;
|
||||
s: ShortString;
|
||||
s, EnumUnitName: String;
|
||||
begin
|
||||
EnumType := GetPropType;
|
||||
EnumUnitName := GetPropTypeUnitName;
|
||||
with GetTypeData(EnumType)^ do
|
||||
for I := MinValue to MaxValue do begin
|
||||
s := GetEnumName(EnumType, I);
|
||||
Proc(s);
|
||||
// An empty string and the enum's unit name happen in gaps
|
||||
// of a non-contiguous enum. Why the unit name? A bug in FPC code?
|
||||
if (s <> '') and (s <> EnumUnitName) then
|
||||
Proc(s);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user