8000 Merge pull request #1273 from github/fixes/1248-null-exception-when-n… · github/VisualStudio@02c6a94 · GitHub
[go: up one dir, main page]

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

Commit 02c6a94

Browse files
authored
Merge pull request #1273 from github/fixes/1248-null-exception-when-no-remote
Fix null reference when no remote branch
2 parents 0fbb8b8 + f640238 commit 02c6a94

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)
0