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

Commit f4da760

Browse files
Validating data after a GitClient is present
1 parent a66bd28 commit f4da760

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/GitHub.Api/Git/Repository.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ public void Initialize(IGitClient client)
607607
Logger.Trace("Initialize");
608608

609609
gitClient = client;
610+
cacheContainer.GitUserCache.ValidateData();
610611
}
611612

612613
public void SetNameAndEmail(string name, string email)
@@ -660,20 +661,23 @@ private void HandleUserCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
660661

661662
private void UpdateUserAndEmail()
662663
{
663-
if (gitClient != null)
664-
{
665-
Logger.Trace("UpdateUserAndEmail");
664+
Logger.Trace("UpdateUserAndEmail");
666665

667-
gitClient.GetConfigUserAndEmail()
668-
.ThenInUI((success, value) =>
669-
{
670-
if (success)
671-
{
672-
Name = value.Name;
673-
Email = value.Email;
674-
}
675-
}).Start();
666+
if (gitClient == null)
667+
{
668+
Logger.Trace("GitClient is null");
669+
return;
676670
}
671+
672+
gitClient.GetConfigUserAndEmail()
673+
.ThenInUI((success, value) =>
674+
{
675+
if (success)
676+
{
677+
Name = value.Name;
678+
Email = value.Email;
679+
}
680+
}).Start();
677681
}
678682

679683
protected static ILogging Logger { get; } = Logging.GetLogger<User>();

0 commit comments

Comments
 (0)