From 3ce580b682c31df36d28d0a3adbd764a9d1df748 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 4 Jul 2024 16:47:28 +0800 Subject: [PATCH] fix: when the remote branch is deleted, deleting the local branch will throw NRE (#238) --- src/ViewModels/DeleteBranch.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/DeleteBranch.cs b/src/ViewModels/DeleteBranch.cs index 292cc2aa..aafede8d 100644 --- a/src/ViewModels/DeleteBranch.cs +++ b/src/ViewModels/DeleteBranch.cs @@ -36,7 +36,8 @@ namespace SourceGit.ViewModels if (branch.IsLocal && !string.IsNullOrEmpty(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 };