Skip to content

Commit

Permalink
Fix: Fixed null warnings in the details layout (#13963)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Nov 20, 2023
1 parent be7bf3c commit 4091748
Showing 1 changed file with 12 additions and 8 deletions.
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

0 comments on commit 4091748

Please sign in to comment.