Skip to content

Fix: Fixed null warnings in the details layout #13963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -136,7 +135,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)

var parameters = (NavigationArguments)eventArgs.Parameter;
if (parameters.IsLayoutSwitch)
ReloadItemIconsAsync();
_ = ReloadItemIconsAsync();

UpdateSortOptionsCommand = new RelayCommand<string>(x =>
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
}
Expand Down