Skip to content

Commit c4e890d

Browse files
committed
Avoid IndexOutOfRangeException.
Suppress the exception reported in #498.
1 parent cdcc738 commit c4e890d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ bool ValidateRemoteCertificate(object rcbSender, X509Certificate rcbCertificate,
917917

918918
if ((rcbPolicyErrors & SslPolicyErrors.RemoteCertificateChainErrors) != 0 && caCertificateChain != null)
919919
{
920-
if (caCertificateChain.Build((X509Certificate2) rcbCertificate))
920+
if (caCertificateChain.Build((X509Certificate2) rcbCertificate) && caCertificateChain.ChainStatus.Length > 0)
921921
{
922922
var chainStatus = caCertificateChain.ChainStatus[0].Status & ~X509ChainStatusFlags.UntrustedRoot;
923923
if (chainStatus == X509ChainStatusFlags.NoError)

0 commit comments

Comments
 (0)