LCL: Prevent a rare range error in ImageListResolution

git-svn-id: branches/fixes_2_0@60174 -
This commit is contained in:
mattias 2019-01-24 09:41:49 +00:00
parent f001cc32ec
commit b69c815f04

View File

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