LazControls: fix potential crash in TListFilterEdit and TTreeFilterEdit, issue #21756, patch from Denis

git-svn-id: trunk@36778 -
This commit is contained in:
juha 2012-04-14 20:00:50 +00:00
parent 33b839ba02
commit 8e7a33a863
2 changed files with 9 additions and 1 deletions

View File

@ -173,6 +173,8 @@ var
s: string;
clb: TCustomCheckListBox;
begin
if fFilteredListbox = nil then
exit;
clb:=Nil;
if fFilteredListbox is TCustomCheckListBox then
clb:=TCustomCheckListBox(fFilteredListbox);
@ -197,6 +199,8 @@ procedure TListFilterEdit.StoreSelection;
var
i: Integer;
begin
if fFilteredListbox = nil then
exit;
fSelectionList.Clear;
if fFilteredListbox.SelCount > 0 then
for i := 0 to fFilteredListbox.Count-1 do

View File

@ -438,8 +438,10 @@ procedure TTreeFilterEdit.ApplyFilterCore;
var
i: Integer;
begin
if fFilteredTreeview = nil then
exit;
fFilteredTreeview.BeginUpdate;
if Assigned(fBranches) then begin // Apply filter for the brances
if Assigned(fBranches) then begin // Apply filter for the branches
for i:=0 to fBranches.Count-1 do
fBranches[i].ApplyFilter;
end
@ -459,6 +461,8 @@ var
ANode: TTreeNode;
begin
fSelectionList.Clear;
if fFilteredTreeview = nil then
exit;
ANode:=fFilteredTreeview.Selected;
while ANode<>nil do begin
fSelectionList.Insert(0,ANode.Text);