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,6 +36,7 @@ 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);
if (TrackingRemoteBranch != null)
DeleteTrackingRemoteTip = new Views.NameHighlightedTextBlock("DeleteBranch.WithTrackingRemote", TrackingRemoteBranch.FriendlyName); DeleteTrackingRemoteTip = new Views.NameHighlightedTextBlock("DeleteBranch.WithTrackingRemote", TrackingRemoteBranch.FriendlyName);
} }