Skip to content

Commit

Permalink
fix(helix): avoid NPE from user passing null client id (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Jul 1, 2023
1 parent 974c93f commit 42d5bfc
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -13,6 +13,7 @@
import org.jetbrains.annotations.Nullable;

import java.time.Duration;
import java.util.Objects;

@Slf4j
public final class TwitchHelixTokenManager {
Expand Down Expand Up @@ -62,7 +63,7 @@ public TwitchHelixTokenManager(String clientId, String clientSecret, OAuth2Crede
this.defaultAuthToken = defaultAuthToken;

if (defaultAuthToken != null) {
this.defaultClientId = defaultAuthToken.getContext().getOrDefault(CLIENT_ID_CONTEXT, clientId).toString();
this.defaultClientId = Objects.toString(defaultAuthToken.getContext().getOrDefault(CLIENT_ID_CONTEXT, clientId), null);
twitchIdentityProvider.getAdditionalCredentialInformation(defaultAuthToken).ifPresent(oauth -> {
populateCache(oauth);
this.defaultClientId = extractClientId(oauth);
Expand Down

0 comments on commit 42d5bfc

Please sign in to comment.