fix: avoid NRE in ContextMenuExtension (#526)

This commit is contained in:
GadflyFang 2024-09-29 16:05:02 +08:00 committed by GitHub
parent 18e0479288
commit c7332aff03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,4 @@
using System.ComponentModel;
using Avalonia.Controls;
namespace SourceGit.Views
@ -15,7 +14,7 @@ namespace SourceGit.Views
menu.Closing += OnContextMenuClosing; // Clear context menu because it is dynamic.
control.ContextMenu = menu;
control.ContextMenu.Open();
control.ContextMenu?.Open();
}
private static void OnContextMenuClosing(object sender, CancelEventArgs e)