Skip to content

Commit 4091748

Browse files
authored
Fix: Fixed null warnings in the details layout (#13963)
1 parent be7bf3c commit 4091748

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using CommunityToolkit.WinUI.UI;
5-
using Files.App.Actions;
65
using Files.App.UserControls.Selection;
76
using Microsoft.UI.Input;
87
using Microsoft.UI.Xaml;
@@ -104,7 +103,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
104103

105104
base.OnNavigatedTo(eventArgs);
106105

107-
if (FolderSettings.ColumnsViewModel is not null)
106+
if (FolderSettings?.ColumnsViewModel is not null)
108107
{
109108
ColumnsViewModel.DateCreatedColumn = FolderSettings.ColumnsViewModel.DateCreatedColumn;
110109
ColumnsViewModel.DateDeletedColumn = FolderSettings.ColumnsViewModel.DateDeletedColumn;
@@ -136,7 +135,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
136135

137136
var parameters = (NavigationArguments)eventArgs.Parameter;
138137
if (parameters.IsLayoutSwitch)
139-
ReloadItemIconsAsync();
138+
_ = ReloadItemIconsAsync();
140139

141140
UpdateSortOptionsCommand = new RelayCommand<string>(x =>
142141
{
@@ -441,7 +440,8 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
441440
if (listViewItem is not null)
442441
{
443442
var textBox = listViewItem.FindDescendant("ItemNameTextBox") as TextBox;
444-
await CommitRenameAsync(textBox);
443+
if (textBox is not null)
444+
await CommitRenameAsync(textBox);
445445
}
446446
}
447447
return;
@@ -477,7 +477,8 @@ clickedItem is Microsoft.UI.Xaml.Shapes.Rectangle
477477
if (listViewItem is not null)
478478
{
479479
var textBox = listViewItem.FindDescendant("ItemNameTextBox") as TextBox;
480-
await CommitRenameAsync(textBox);
480+
if (textBox is not null)
481+
await CommitRenameAsync(textBox);
481482
}
482483
}
483484
}
@@ -842,9 +843,12 @@ private void RemoveTagIcon_Tapped(object sender, TappedRoutedEventArgs e)
842843

843844
var tagId = FileTagsSettingsService.GetTagsByName(tagName).FirstOrDefault()?.Uid;
844845

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+
}
848852

849853
e.Handled = true;
850854
}

0 commit comments

Comments
 (0)