fix: when the remote branch is deleted, deleting the local branch will throw NRE (#238)

This commit is contained in:
leo 2024-07-04 16:47:28 +08:00
parent 15e7df6085
commit 3ce580b682
No known key found for this signature in database

View file

@ -36,7 +36,8 @@ namespace SourceGit.ViewModels
if (branch.IsLocal && !string.IsNullOrEmpty(branch.Upstream)) if (branch.IsLocal && !string.IsNullOrEmpty(branch.Upstream))
{ {
TrackingRemoteBranch = repo.Branches.Find(x => x.FullName == branch.Upstream); TrackingRemoteBranch = repo.Branches.Find(x => x.FullName == branch.Upstream);
DeleteTrackingRemoteTip = new Views.NameHighlightedTextBlock("DeleteBranch.WithTrackingRemote", TrackingRemoteBranch.FriendlyName); if (TrackingRemoteBranch != null)
DeleteTrackingRemoteTip = new Views.NameHighlightedTextBlock("DeleteBranch.WithTrackingRemote", TrackingRemoteBranch.FriendlyName);
} }
View = new Views.DeleteBranch() { DataContext = this }; View = new Views.DeleteBranch() { DataContext = this };