diff --git a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs index 6e0393d7d906..332cbd05241c 100644 --- a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. See the LICENSE. using CommunityToolkit.WinUI.UI; -using Files.App.Actions; using Files.App.UserControls.Selection; using Microsoft.UI.Input; using Microsoft.UI.Xaml; @@ -104,7 +103,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) base.OnNavigatedTo(eventArgs); - if (FolderSettings.ColumnsViewModel is not null) + if (FolderSettings?.ColumnsViewModel is not null) { ColumnsViewModel.DateCreatedColumn = FolderSettings.ColumnsViewModel.DateCreatedColumn; ColumnsViewModel.DateDeletedColumn = FolderSettings.ColumnsViewModel.DateDeletedColumn; @@ -136,7 +135,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) var parameters = (NavigationArguments)eventArgs.Parameter; if (parameters.IsLayoutSwitch) - ReloadItemIconsAsync(); + _ = ReloadItemIconsAsync(); UpdateSortOptionsCommand = new RelayCommand(x => { @@ -441,7 +440,8 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) if (listViewItem is not null) { var textBox = listViewItem.FindDescendant("ItemNameTextBox") as TextBox; - await CommitRenameAsync(textBox); + if (textBox is not null) + await CommitRenameAsync(textBox); } } return; @@ -477,7 +477,8 @@ clickedItem is Microsoft.UI.Xaml.Shapes.Rectangle if (listViewItem is not null) { var textBox = listViewItem.FindDescendant("ItemNameTextBox") as TextBox; - await CommitRenameAsync(textBox); + if (textBox is not null) + await CommitRenameAsync(textBox); } } } @@ -842,9 +843,12 @@ private void RemoveTagIcon_Tapped(object sender, TappedRoutedEventArgs e) var tagId = FileTagsSettingsService.GetTagsByName(tagName).FirstOrDefault()?.Uid; - item.FileTags = item.FileTags - .Except(new string[] { tagId }) - .ToArray(); + if (tagId is not null) + { + item.FileTags = item.FileTags + .Except(new string[] { tagId }) + .ToArray(); + } e.Handled = true; }