Skip to content

Commit c7332af

Browse files
authored
fix: avoid NRE in ContextMenuExtension (#526)
1 parent 18e0479 commit c7332af

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Views/ContextMenuExtension.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.ComponentModel;
2-
32
using Avalonia.Controls;
43

54
namespace SourceGit.Views
@@ -15,7 +14,7 @@ public static void OpenContextMenu(this Control control, ContextMenu menu)
1514
menu.Closing += OnContextMenuClosing; // Clear context menu because it is dynamic.
1615

1716
control.ContextMenu = menu;
18-
control.ContextMenu.Open();
17+
control.ContextMenu?.Open();
1918
}
2019

2120
private static void OnContextMenuClosing(object sender, CancelEventArgs e)

0 commit comments

Comments
 (0)