Skip to content
Permalink
Browse files

Silence crash happening in some very early calls to apphelpers.FindNo…

…de, also triggered by RestoreTabs. Probably helps here: https://www.heidisql.com/forum.php?t=35551
  • Loading branch information
ansgarbecker committed Feb 4, 2020
1 parent a164657 commit 33300bd17197cebf67cefc9a24d542dbaed781b0
Showing with 9 additions and 4 deletions.
  1. +9 −4 source/apphelpers.pas
@@ -1528,10 +1528,15 @@ function FindNode(VT: TVirtualStringTree; idx: Int64; ParentNode: PVirtualNode):
begin
// Helper to find a node by its index
Result := nil;
if Assigned(ParentNode) then
Node := VT.GetFirstChild(ParentNode)
else
Node := VT.GetFirst;
try
if Assigned(ParentNode) then
Node := VT.GetFirstChild(ParentNode)
else
Node := VT.GetFirst;
except
// Sporadically, TBaseVirtualTree.GetFirst throws an exception when reading FRoot.FirstChild
// Tab restoring is sometimes crashing for that reason.
end;
while Assigned(Node) do begin
// Note: Grid.RootNodeCount is unfortunately Cardinal, not UInt64.
if Node.Index = idx then begin

0 comments on commit 33300bd

Please sign in to comment.
You can’t perform that action at this time.