IDE: Fix crash when TContainedAction instead of TCustomAction is added to ActionList. Issue #20242, patch from Andrew G. Khodotov

git-svn-id: trunk@32355 -
This commit is contained in:
juha 2011-09-15 17:22:16 +00:00
parent ad2d7983d8
commit ae9dead608

View File

@ -734,21 +734,18 @@ begin
ACanvas.Brush.Color := clHighlight; ACanvas.Brush.Color := clHighlight;
ACanvas.Font.Color := clHighlightText; ACanvas.Font.Color := clHighlightText;
end end
else else begin
begin
ACanvas.Brush.Color := clWindow; ACanvas.Brush.Color := clWindow;
ACanvas.Font.Color := clWindowText; ACanvas.Font.Color := clWindowText;
end; end;
AAction := TListBox(Control).Items.Objects[Index] as TCustomAction;
S := TListBox(Control).Items[Index];
R := ARect; R := ARect;
dh := R.Bottom - R.Top; dh := R.Bottom - R.Top;
ACanvas.FillRect(R); ACanvas.FillRect(R);
inc(R.Left, 2); inc(R.Left, 2);
if FActionList.Images <> nil then if (TListBox(Control).Items.Objects[Index] is TCustomAction)
begin and (FActionList.Images <> nil) then begin
AAction := TListBox(Control).Items.Objects[Index] as TCustomAction;
S := TListBox(Control).Items[Index];
R.Right := R.Left + dh; R.Right := R.Left + dh;
if AAction.ImageIndex <> -1 then if AAction.ImageIndex <> -1 then
begin begin