Skip to content

Commit dd96e1a

Browse files
authored
Fix: Fixed crash that would occur when copying path (#12765)
1 parent 3f50186 commit dd96e1a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Files.App/Actions/FileSystem/CopyPathAction.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ public Task ExecuteAsync()
3535
if (FtpHelpers.IsFtpPath(path))
3636
path = path.Replace("\\", "/", StringComparison.Ordinal);
3737

38-
DataPackage data = new();
39-
data.SetText(path);
40-
41-
Clipboard.SetContent(data);
42-
Clipboard.Flush();
38+
SafetyExtensions.IgnoreExceptions(() =>
39+
{
40+
DataPackage data = new();
41+
data.SetText(path);
42+
43+
Clipboard.SetContent(data);
44+
Clipboard.Flush();
45+
});
4346
}
4447

4548
return Task.CompletedTask;

0 commit comments

Comments
 (0)