Skip to content

Commit

Permalink
Ignore exceptions whe getting created item
Browse files Browse the repository at this point in the history
  • Loading branch information
gave92 committed Apr 1, 2022
1 parent 9c6461f commit 5452844
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Files.Launcher/MessageHandlers/RecycleBinHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ private async void RecycleBinWatcher_Changed(object sender, FileSystemEventArgs
};
if (e.ChangeType == WatcherChangeTypes.Created)
{
using var folderItem = new ShellItem(e.FullPath);
using var folderItem = SafetyExtensions.IgnoreExceptions(() => new ShellItem(e.FullPath));
if (folderItem == null) return;
var shellFileItem = ShellFolderExtensions.GetShellFileItem(folderItem);
response["Item"] = JsonConvert.SerializeObject(shellFileItem);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Files.Launcher/MessageHandlers/Win32MessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ private async void DirectoryWatcher_Changed(object sender, FileSystemEventArgs e
};
if (e.ChangeType == WatcherChangeTypes.Created)
{
using var folderItem = new ShellItem(e.FullPath);
using var folderItem = SafetyExtensions.IgnoreExceptions(() => new ShellItem(e.FullPath));
if (folderItem == null) return;
var shellFileItem = ShellFolderExtensions.GetShellFileItem(folderItem);
response["Item"] = JsonConvert.SerializeObject(shellFileItem);
}
Expand Down

0 comments on commit 5452844

Please sign in to comment.