Skip to content

Commit c3c444b

Browse files
committed
Guard against null _gitHubClient (which happens during unit testing)
1 parent 877bc5b commit c3c444b

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
@@ -84,7 +84,11 @@ public GitHubProvider(IGitHubClient gitHubClient, IMapper mapper)
8484
_mapper = mapper;
8585

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

0 commit comments

Comments
 (0)