LCL: Prevent a rare range error in ImageListResolution.

git-svn-id: trunk@60062 -
This commit is contained in:
juha 2019-01-12 17:01:24 +00:00
parent 5f255ad9d1
commit 33c6cbeb45

View File

@ -333,7 +333,7 @@ end;
procedure TCustomImageListResolution.CheckIndex(AIndex: Integer;
AForInsert: Boolean);
// aviod exceptionframe generation
// avoid exceptionframe generation
procedure Error;
begin
raise EInvalidOperation.Create(SInvalidIndex);
@ -364,10 +364,9 @@ begin
Clear;
Exit;
end;
CheckIndex(AIndex);
InternalMove(AIndex, FCount - 1, True);
if AIndex < FCount-1 then
InternalMove(AIndex, FCount-1, True);
Dec(FCount);
if HandleAllocated
then TWSCustomImageListResolutionClass(WidgetSetClass).Delete(Self, AIndex);
@ -641,8 +640,8 @@ end;
Moves an image from the CurIndex'th location to NewIndex'th location
without notifying the widgetset
------------------------------------------------------------------------------}
procedure TCustomImageListResolution.InternalMove(ACurIndex,
ANewIndex: Cardinal; AIgnoreCurrent: Boolean);
procedure TCustomImageListResolution.InternalMove(ACurIndex, ANewIndex: Cardinal;
AIgnoreCurrent: Boolean);
var
ImgSize, DataSize: Cardinal;
p: Pointer;