Skip to content
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

Fix: Fixed NullReferenceException in Item_Opening #14699

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Changes from 2 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
18 changes: 5 additions & 13 deletions src/Files.App/UserControls/Menus/FileTagsContextMenu.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Utils;
using Files.App.Helpers;
using Files.Core.Services.Settings;
using Files.Core.ViewModels.FileTags;
using Files.Shared.Extensions;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using System;
using System.Collections.Generic;
using System.Linq;
using static Files.App.Helpers.MenuFlyoutHelper;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Markup;

namespace Files.App.UserControls.Menus
{
Expand Down Expand Up @@ -46,7 +37,8 @@ public FileTagsContextMenu(IEnumerable<ListedItem> selectedItems)

SelectedItems = selectedItems;

Opening += Item_Opening;
if (SelectedItems is not null)
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
Opening += Item_Opening;
}

private void TagItem_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
Expand All @@ -62,7 +54,7 @@ private void TagItem_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
}
}

private void Item_Opening(object sender, object e)
private void Item_Opening(object? sender, object e)
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
{
Opening -= Item_Opening;

Expand Down
Loading