Skip to content

Commit

Permalink
Ignore cert refresh when not logged in.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 715556067
  • Loading branch information
ftsui authored and copybara-github committed Jan 14, 2025
1 parent 58e8a32 commit 6694e2b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sharing/certificates/nearby_share_certificate_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,15 @@ void NearbyShareCertificateManagerImpl::PrivateCertificateRefresh(
absl::Time now = context_->GetClock()->Now();
certificate_storage_->RemoveExpiredPrivateCertificates(now);

std::optional<AccountManager::Account> account =
account_manager_.GetCurrentAccount();
if (!account.has_value()) {
LOG(INFO) << "Not logged in on refreshing private certificates, ignoring";
private_certificate_expiration_scheduler_->HandleResult(
/*success=*/true);
return;
}

std::vector<NearbySharePrivateCertificate> certs =
*certificate_storage_->GetPrivateCertificates();
if (certs.size() == NumExpectedPrivateCertificates()) {
Expand Down Expand Up @@ -753,8 +762,6 @@ void NearbyShareCertificateManagerImpl::PrivateCertificateRefresh(
std::max(latest_not_after[cert.visibility()], cert.not_after());
}

std::optional<AccountManager::Account> account =
account_manager_.GetCurrentAccount();
std::optional<std::string> email =
account.has_value()
? account->email
Expand Down

0 comments on commit 6694e2b

Please sign in to comment.