mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 05:40:24 +02:00
LCL: Fix TreeView "nothing selected" index. Return -1 instead of crash. For Delphi compatibility. Issue #27759, patch from Ocean.
git-svn-id: trunk@48556 -
This commit is contained in:
parent
384c407672
commit
f641bb7c5d
@ -1135,10 +1135,10 @@ function TTreeNode.GetIndex: Integer;
|
||||
var
|
||||
ANode: TTreeNode;
|
||||
begin
|
||||
if FIndex>=0 then begin
|
||||
Result:=FIndex;
|
||||
exit;
|
||||
end;
|
||||
if self = nil then
|
||||
exit(-1);
|
||||
if FIndex>=0 then
|
||||
exit(FIndex);
|
||||
// many algorithms uses the last sibling, so we check that first for speed
|
||||
if (Parent<>nil) and (Parent[Parent.Count-1]=Self) then begin
|
||||
Result:=Parent.Count-1;
|
||||
|
Loading…
Reference in New Issue
Block a user