fix: crash when try to open context menu without selected changes in Changes page

This commit is contained in:
leo 2024-06-15 14:50:05 +08:00
parent 6de92bb4d8
commit f204a744bd
No known key found for this signature in database
GPG key ID: B528468E49CD0E58

View file

@ -405,7 +405,7 @@ namespace SourceGit.ViewModels
public ContextMenu CreateContextMenuForUnstagedChanges() public ContextMenu CreateContextMenuForUnstagedChanges()
{ {
if (_selectedUnstaged.Count == 0) if (_selectedUnstaged == null || _selectedUnstaged.Count == 0)
return null; return null;
var menu = new ContextMenu(); var menu = new ContextMenu();
@ -691,7 +691,7 @@ namespace SourceGit.ViewModels
public ContextMenu CreateContextMenuForStagedChanges() public ContextMenu CreateContextMenuForStagedChanges()
{ {
if (_selectedStaged.Count == 0) if (_selectedStaged == null || _selectedStaged.Count == 0)
return null; return null;
var menu = new ContextMenu(); var menu = new ContextMenu();