LCL/ShellCtrls: Do not raise a silent exception when the current path in the TreeView does not exist any more.

This commit is contained in:
wp_xyz 2023-11-12 17:06:03 +01:00
parent 01d11f00ee
commit 222117e473

View File

@ -652,12 +652,8 @@ begin
RootNode := Items.AddChild(nil, FRoot); RootNode := Items.AddChild(nil, FRoot);
RootNode.HasChildren := True; RootNode.HasChildren := True;
RootNode.Expand(False); RootNode.Expand(False);
try if Exists(CurrPath) then
SetPath(CurrPath); SetPath(CurrPath);
except
// CurrPath may have been removed in the mean time by another process, just ignore
on E: EInvalidPath do ;//
end;
end; end;
finally finally
EndUpdate; EndUpdate;
@ -675,12 +671,8 @@ begin
try try
BeginUpdate; BeginUpdate;
Refresh(nil); Refresh(nil);
try if Exists(CurrPath) then
SetPath(CurrPath); SetPath(CurrPath);
except
// CurrPath may have been removed in the mean time by another process, just ignore
on E: EInvalidPath do ;//
end;
finally finally
EndUpdate; EndUpdate;
end; end;
@ -710,12 +702,8 @@ begin
RootNode := Items.AddChild(nil, FRoot); RootNode := Items.AddChild(nil, FRoot);
RootNode.HasChildren := True; RootNode.HasChildren := True;
RootNode.Expand(False); RootNode.Expand(False);
try if Exists(Currpath) then
SetPath(CurrPath); SetPath(CurrPath);
except
// CurrPath may have been removed in the mean time by another process, just ignore
on E: EInvalidPath do ;//
end;
end; end;
finally finally
EndUpdate; EndUpdate;