LCL TImageList: ignore out of range index when drawing, fixes #0012130: Mac OS X : TreeView1CustomDrawItem AV

git-svn-id: trunk@16576 -
This commit is contained in:
tombo 2008-09-13 09:34:42 +00:00
parent 6909aaac4c
commit b333c7d0f5
2 changed files with 2 additions and 1 deletions

View File

@ -468,7 +468,7 @@ end;
procedure TCustomImageList.Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer;
ADrawEffect: TGraphicsDrawEffect);
begin
if (FCount = 0) or (AIndex >= FCount) then Exit;
if (AIndex < 0) or (AIndex >= FCount) then Exit;
ReferenceNeeded;
TWSCustomImageListClass(WidgetSetClass).Draw(Self, AIndex, ACanvas, Rect(AX, AY, FWidth, FHeight),

View File

@ -105,6 +105,7 @@ var
ListImg, DeviceImg: TLazIntfImage;
ImgHandle, MskHandle: HBitmap;
begin
if (AIndex < 0) or (AIndex >= Count) then Exit;
if ADrawEffect = gdeNormal then
begin
ABitmap := TBitmap(Items[AIndex]);