Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 9547277

Browse files
committed
Fix null ref when no remote branch
This issue was introduced in #1248.
1 parent 7287185 commit 9547277

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/GitHub.Exports/Models/BranchModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ public BranchModel(LibGit2Sharp.Branch branch, IRepositoryModel repo)
3131
Extensions.Guard.ArgumentNotNull(repo, nameof(repo));
3232
Name = DisplayName = branch.FriendlyName;
3333
#pragma warning disable 0618 // TODO: Replace `Branch.Remote` with `Repository.Network.Remotes[branch.RemoteName]`.
34-
var remoteUrl = branch.Remote.Url;
34+
Repository = branch.IsRemote ? new LocalRepositoryModel(branch.Remote.Url) : repo;
3535
#pragma warning restore 0618
36-
Repository = branch.IsRemote ? new LocalRepositoryModel(remoteUrl) : repo;
3736
IsTracking = branch.IsTracking;
3837
Id = String.Format(CultureInfo.InvariantCulture, "{0}/{1}", Repository.Owner, Name);
3938
}

0 commit comments

Comments
 (0)