fix<Pull>: fix crash when repo's remote has no branches

This commit is contained in:
leo 2021-09-26 13:50:06 +08:00
parent b892dc7c66
commit 9862845f82

View file

@ -60,6 +60,8 @@ namespace SourceGit.Views.Popups {
var branches = repo.Branches.Where(x => x.Remote == remote.Name).ToList(); var branches = repo.Branches.Where(x => x.Remote == remote.Name).ToList();
cmbBranches.ItemsSource = branches; cmbBranches.ItemsSource = branches;
if (branches.Count == 0) return;
if (prefered != null && remote.Name == prefered.Remote) { if (prefered != null && remote.Name == prefered.Remote) {
cmbBranches.SelectedItem = branches.Find(x => x.FullName == prefered.FullName); cmbBranches.SelectedItem = branches.Find(x => x.FullName == prefered.FullName);
} else { } else {