Skip to content

Commit bb9db1a

Browse files
committed
Fix caching null reference
1 parent 0bff621 commit bb9db1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Umbraco.Forms.Integrations.Crm.Hubspot/Services/HubspotContactService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,15 @@ private bool TryGetSavedRefreshToken(out string refreshToken)
292292

293293
private async Task<string> GetOAuthAccessTokenFromCacheOrRefreshToken(string refreshToken)
294294
{
295-
var accessToken = _appCaches.RuntimeCache.Get(AccessTokenCacheKey).ToString();
296-
if (string.IsNullOrEmpty(accessToken))
295+
var accessToken = _appCaches.RuntimeCache.Get(AccessTokenCacheKey);
296+
if (accessToken != null)
297297
{
298298
// No access token in the cache, so get a new one from the refresh token.
299299
await RefreshOAuthAccessToken(refreshToken);
300300
accessToken = _appCaches.RuntimeCache.Get(AccessTokenCacheKey).ToString();
301301
}
302302

303-
return accessToken;
303+
return accessToken != null ? accessToken.ToString() : string.Empty;
304304
}
305305

306306
private async Task RefreshOAuthAccessToken(string refreshToken)

0 commit comments

Comments
 (0)