|
2 | 2 | // Licensed under the MIT License. See the LICENSE. |
3 | 3 |
|
4 | 4 | using CommunityToolkit.WinUI.UI; |
5 | | -using Files.App.Actions; |
6 | 5 | using Files.App.UserControls.Selection; |
7 | 6 | using Microsoft.UI.Input; |
8 | 7 | using Microsoft.UI.Xaml; |
@@ -104,7 +103,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) |
104 | 103 |
|
105 | 104 | base.OnNavigatedTo(eventArgs); |
106 | 105 |
|
107 | | - if (FolderSettings.ColumnsViewModel is not null) |
| 106 | + if (FolderSettings?.ColumnsViewModel is not null) |
108 | 107 | { |
109 | 108 | ColumnsViewModel.DateCreatedColumn = FolderSettings.ColumnsViewModel.DateCreatedColumn; |
110 | 109 | ColumnsViewModel.DateDeletedColumn = FolderSettings.ColumnsViewModel.DateDeletedColumn; |
@@ -136,7 +135,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) |
136 | 135 |
|
137 | 136 | var parameters = (NavigationArguments)eventArgs.Parameter; |
138 | 137 | if (parameters.IsLayoutSwitch) |
139 | | - ReloadItemIconsAsync(); |
| 138 | + _ = ReloadItemIconsAsync(); |
140 | 139 |
|
141 | 140 | UpdateSortOptionsCommand = new RelayCommand<string>(x => |
142 | 141 | { |
@@ -441,7 +440,8 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) |
441 | 440 | if (listViewItem is not null) |
442 | 441 | { |
443 | 442 | var textBox = listViewItem.FindDescendant("ItemNameTextBox") as TextBox; |
444 | | - await CommitRenameAsync(textBox); |
| 443 | + if (textBox is not null) |
| 444 | + await CommitRenameAsync(textBox); |
445 | 445 | } |
446 | 446 | } |
447 | 447 | return; |
@@ -477,7 +477,8 @@ clickedItem is Microsoft.UI.Xaml.Shapes.Rectangle |
477 | 477 | if (listViewItem is not null) |
478 | 478 | { |
479 | 479 | var textBox = listViewItem.FindDescendant("ItemNameTextBox") as TextBox; |
480 | | - await CommitRenameAsync(textBox); |
| 480 | + if (textBox is not null) |
| 481 | + await CommitRenameAsync(textBox); |
481 | 482 | } |
482 | 483 | } |
483 | 484 | } |
@@ -842,9 +843,12 @@ private void RemoveTagIcon_Tapped(object sender, TappedRoutedEventArgs e) |
842 | 843 |
|
843 | 844 | var tagId = FileTagsSettingsService.GetTagsByName(tagName).FirstOrDefault()?.Uid; |
844 | 845 |
|
845 | | - item.FileTags = item.FileTags |
846 | | - .Except(new string[] { tagId }) |
847 | | - .ToArray(); |
| 846 | + if (tagId is not null) |
| 847 | + { |
| 848 | + item.FileTags = item.FileTags |
| 849 | + .Except(new string[] { tagId }) |
| 850 | + .ToArray(); |
| 851 | + } |
848 | 852 |
|
849 | 853 | e.Handled = true; |
850 | 854 | } |
|
0 commit comments