Skip to content

Commit 26d2ebb

Browse files
authored
Fix null-pointer exception in credential parsing (#44)
1 parent c42703e commit 26d2ebb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apis/platform_common/Credential.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public PlatformRefreshTokenCredential(IAuthorizationCodeFlow flow, string userId
107107
private static PlatformRefreshTokenCredential GetTokenCredentialAutomatically()
108108
{
109109
var serverRefreshToken = Environment.GetEnvironmentVariable("IMPROBABLE_PLATFORM_REFRESH_TOKEN");
110-
if (serverRefreshToken != "")
110+
if (!string.IsNullOrEmpty(serverRefreshToken))
111111
{
112112
var clientSecrets = new ClientSecrets
113113
{
@@ -127,7 +127,7 @@ private static PlatformRefreshTokenCredential GetTokenCredentialAutomatically()
127127
};
128128

129129
var tokenFile = possibleTokenFiles.FirstOrDefault(File.Exists);
130-
if (tokenFile != null)
130+
if (!string.IsNullOrEmpty(tokenFile))
131131
{
132132
try
133133
{
@@ -144,4 +144,4 @@ private static PlatformRefreshTokenCredential GetTokenCredentialAutomatically()
144144
throw new NoRefreshTokenFoundException(RefreshTokenNotFoundMessage);
145145
}
146146
}
147-
}
147+
}

0 commit comments

Comments
 (0)