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