Skip to content

Commit

Permalink
Fix possible NRE
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Dec 15, 2023
1 parent a60513e commit 4b29daa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3293,9 +3293,11 @@ private async void OnPlayingSessionState(SteamUser.PlayingSessionStateCallback c
}

private async void OnRefreshTokensTimer(object? state = null) {
if (AccessTokenValidUntil.HasValue && (AccessTokenValidUntil.Value > DateTime.UtcNow.AddMinutes(MinimumAccessTokenValidityMinutes))) {
DateTime accessTokenValidUntil = AccessTokenValidUntil.GetValueOrDefault();

if ((accessTokenValidUntil > DateTime.MinValue) && (accessTokenValidUntil > DateTime.UtcNow.AddMinutes(MinimumAccessTokenValidityMinutes))) {
// We don't need to refresh just yet
InitRefreshTokensTimer(AccessTokenValidUntil.Value);
InitRefreshTokensTimer(accessTokenValidUntil);
}

await RefreshWebSession().ConfigureAwait(false);
Expand Down

0 comments on commit 4b29daa

Please sign in to comment.