diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 78aceadb81..10f6fb4e41 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -1219,8 +1219,10 @@ bool QSslSocketBackendPrivate::verifyPeerTrust() QCFType certArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); for (const QSslCertificate &cert : qAsConst(configuration.caCertificates)) { QCFType certData = cert.d->derData.toCFData(); - QCFType certRef = SecCertificateCreateWithData(NULL, certData); - CFArrayAppendValue(certArray, certRef); + if (QCFType secRef = SecCertificateCreateWithData(NULL, certData)) + CFArrayAppendValue(certArray, secRef); + else + qCWarning(lcSsl, "Failed to create SecCertificate from QSslCertificate"); } SecTrustSetAnchorCertificates(trust, certArray);