From 8ca74d3a9eb4111d6dd1158f16b3c0db7d34e2f8 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 2 Mar 2024 23:44:49 +0800 Subject: [PATCH] fix: crash when request context menu without any change selected --- src/Views/CommitDetail.axaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Views/CommitDetail.axaml.cs b/src/Views/CommitDetail.axaml.cs index 326c612d..00873a72 100644 --- a/src/Views/CommitDetail.axaml.cs +++ b/src/Views/CommitDetail.axaml.cs @@ -19,6 +19,11 @@ namespace SourceGit.Views { private void OnChangeListContextRequested(object sender, ContextRequestedEventArgs e) { if (DataContext is ViewModels.CommitDetail detail) { var datagrid = sender as DataGrid; + if (datagrid.SelectedItem == null) { + e.Handled = true; + return; + } + var menu = detail.CreateChangeContextMenu(datagrid.SelectedItem as Models.Change); menu.Open(datagrid); }