Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 440155b

Browse files
Missing null check on CurrentRemote
1 parent 89bb87e commit 440155b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/GitHub.Api/Git/Repository.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,18 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
354354
new ActionTask(CancellationToken.None, () => {
355355
if (!Nullable.Equals(CurrentConfigBranch, branch))
356356
{
357-
var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
357+
var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
358358

359-
CurrentConfigBranch = branch;
360-
CurrentBranch = currentBranch;
361-
UpdateLocalBranches();
359+
CurrentConfigBranch = branch;
360+
CurrentBranch = currentBranch;
361+
UpdateLocalBranches();
362362
}
363363

364364
if (!Nullable.Equals(CurrentConfigRemote, remote))
365365
{
366-
CurrentConfigRemote = remote;
367-
CurrentRemote = GetGitRemote(remote.Value);
368-
ClearRepositoryInfo();
366+
CurrentConfigRemote = remote;
367+
CurrentRemote = remote.HasValue ? (GitRemote?)GetGitRemote(remote.Value) : null;
368+
ClearRepositoryInfo();
369369
}
370370
}) { Affinity = TaskAffinity.UI }.Start();
371371
}
@@ -412,12 +412,10 @@ private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBr
412412

413413
private void UpdateLocks()
414414
{
415-
if (string.IsNullOrEmpty(CurrentRemote?.Url))
415+
if (CurrentRemote.HasValue)
416416
{
417-
return;
417+
repositoryManager?.UpdateLocks();
418418
}
419-
420-
repositoryManager?.UpdateLocks();
421419
}
422420

423421
private void UpdateLocalBranches()

0 commit comments

Comments
 (0)