LCL/ShellCtrls: Fix ShellTreeView crashing when a file has been deleted by the OS.

(cherry picked from commit e9e8f6ef32)
This commit is contained in:
wp_xyz 2022-07-27 12:49:06 +02:00 committed by Maxim Ganetsky
parent 281dceb262
commit 6e946f7fd0

View File

@ -82,6 +82,11 @@ var
begin
fileName := ATreeView.GetPathFromNode(ANode);
ico := GetShellIcon(fileName);
if ico = nil then
begin
Result := Types.Size(0, 0);
exit;
end;
try
ATreeView.Canvas.Draw(ARect.Left, (ARect.Top + ARect.Bottom - ico.Height) div 2, ico);
Result := Types.Size(ico.Width, ico.Height);