fix: crash when click blank area of change list in Information page of CommitDetail (#192)

This commit is contained in:
leo 2024-06-20 11:11:09 +08:00
parent 02ace694d0
commit c1c27be39a
No known key found for this signature in database

View file

@ -15,6 +15,12 @@ namespace SourceGit.Views
if (DataContext is ViewModels.CommitDetail detail) if (DataContext is ViewModels.CommitDetail detail)
{ {
var datagrid = sender as DataGrid; var datagrid = sender as DataGrid;
if (datagrid.SelectedItem == null)
{
e.Handled = true;
return;
}
detail.ActivePageIndex = 1; detail.ActivePageIndex = 1;
detail.SelectedChanges = new() { datagrid.SelectedItem as Models.Change }; detail.SelectedChanges = new() { datagrid.SelectedItem as Models.Change };
} }