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

Commit f59e930

Browse files
Merge pull request #497 from github-for-unity/fixes/user-update
Validating data after a GitClient is present
2 parents cf05f5f + 9914d79 commit f59e930

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
@@ -647,6 +647,7 @@ public void Initialize(IGitClient client)
647647
Logger.Trace("Initialize");
648648

649649
gitClient = client;
650+
cacheContainer.GitUserCache.ValidateData();
650651
}
651652

652653
public void SetNameAndEmail(string name, string email)
@@ -700,20 +701,23 @@ private void HandleUserCacheUpdatedEvent(CacheUpdateEvent cacheUpdateEvent)
700701

701702
private void UpdateUserAndEmail()
702703
{
703-
if (gitClient != null)
704-
{
705-
Logger.Trace("UpdateUserAndEmail");
704+
Logger.Trace("UpdateUserAndEmail");
706705

707-
gitClient.GetConfigUserAndEmail()
708-
.ThenInUI((success, value) =>
709-
{
710-
if (success)
711-
{
712-
Name = value.Name;
713-
Email = value.Email;
714-
}
715-
}).Start();
706+
if (gitClient == null)
707+
{
708+
Logger.Trace("GitClient is null");
709+
return;
716710
}
711+
712+
gitClient.GetConfigUserAndEmail()
713+
.ThenInUI((success, value) =>
714+
{
715+
if (success)
716+
{
717+
Name = value.Name;
718+
Email = value.Email;
719+
}
720+
}).Start();
717721
}
718722

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

0 commit comments

Comments
 (0)