From f204a744bdf8ebdfbe80417a8037e96079c0f565 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 15 Jun 2024 14:50:05 +0800 Subject: [PATCH] fix: crash when try to open context menu without selected changes in Changes page --- src/ViewModels/WorkingCopy.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index bb982491..5612fbbe 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -405,7 +405,7 @@ namespace SourceGit.ViewModels public ContextMenu CreateContextMenuForUnstagedChanges() { - if (_selectedUnstaged.Count == 0) + if (_selectedUnstaged == null || _selectedUnstaged.Count == 0) return null; var menu = new ContextMenu(); @@ -691,7 +691,7 @@ namespace SourceGit.ViewModels public ContextMenu CreateContextMenuForStagedChanges() { - if (_selectedStaged.Count == 0) + if (_selectedStaged == null || _selectedStaged.Count == 0) return null; var menu = new ContextMenu();