diff --git a/src/Files.App/Actions/Start/PinToStartAction.cs b/src/Files.App/Actions/Start/PinToStartAction.cs index 55f93e5f4e8d..ccecead66d62 100644 --- a/src/Files.App/Actions/Start/PinToStartAction.cs +++ b/src/Files.App/Actions/Start/PinToStartAction.cs @@ -37,12 +37,15 @@ public async Task ExecuteAsync(object? parameter = null) { foreach (ListedItem listedItem in context.ShellPage.SlimContentPage.SelectedItems) { - IStorable storable = listedItem.IsFolder switch + await SafetyExtensions.IgnoreExceptions(async () => { - true => await StorageService.GetFolderAsync(listedItem.ItemPath), - _ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath) - }; - await StartMenuService.PinAsync(storable, listedItem.Name); + IStorable storable = listedItem.IsFolder switch + { + true => await StorageService.GetFolderAsync(listedItem.ItemPath), + _ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath) + }; + await StartMenuService.PinAsync(storable, listedItem.Name); + }); } } else if (context.ShellPage?.ShellViewModel?.CurrentFolder is not null) diff --git a/src/Files.App/Actions/Start/UnpinFromStartAction.cs b/src/Files.App/Actions/Start/UnpinFromStartAction.cs index 6598f4ade86a..2e8f0a13620a 100644 --- a/src/Files.App/Actions/Start/UnpinFromStartAction.cs +++ b/src/Files.App/Actions/Start/UnpinFromStartAction.cs @@ -33,12 +33,15 @@ public async Task ExecuteAsync(object? parameter = null) { foreach (ListedItem listedItem in context.ShellPage?.SlimContentPage.SelectedItems) { - IStorable storable = listedItem.IsFolder switch + await SafetyExtensions.IgnoreExceptions(async () => { - true => await StorageService.GetFolderAsync(listedItem.ItemPath), - _ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath) - }; - await StartMenuService.UnpinAsync(storable); + IStorable storable = listedItem.IsFolder switch + { + true => await StorageService.GetFolderAsync(listedItem.ItemPath), + _ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath) + }; + await StartMenuService.UnpinAsync(storable); + }); } } else