Skip to content

Commit cee34ed

Browse files
committed
Guard against null _gitHubClient (which happens during unit testing)
1 parent 91abd77 commit cee34ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/GitReleaseManager.Core/Provider/GitHubProvider.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ public GitHubProvider(IGitHubClient gitHubClient, IMapper mapper)
8585
_mapper = mapper;
8686

8787
var graphQLClient = new GraphQLHttpClient(new GraphQLHttpClientOptions { EndPoint = new Uri("https://api.github.com/graphql") }, new SystemTextJsonSerializer());
88-
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"bearer {_gitHubClient.Connection.Credentials.Password}");
88+
if (!string.IsNullOrEmpty(_gitHubClient?.Connection?.Credentials?.Password))
89+
{
90+
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"bearer {_gitHubClient.Connection.Credentials.Password}");
91+
}
92+
8993
_graphQLClient = graphQLClient;
9094
}
9195

0 commit comments

Comments
 (0)