Skip to content

Commit 547af6c

Browse files
committed
C#: Introduce null checks in the NugetPackageRestorer.
1 parent 083533a commit 547af6c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
604604
{
605605
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, _) =>
606606
{
607+
if (chain is null || cert is null)
608+
{
609+
return false;
610+
}
607611
chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
608612
chain.ChainPolicy.CustomTrustStore.Add(this.dependabotProxy.Certificate);
609613
return chain.Build(cert);

0 commit comments

Comments
 (0)