QSslCertificate: don't init() if SSL is not supported

QSslCertificate used SSL without checking if SSL is available.

This patch adds such checks to the constructors.

Change-Id: Iea298aded5966641327e22e41ad4665a3d0ec5d3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Jüri Valdmann 2017-05-05 15:18:46 +02:00 committed by Timur Pocheptsov
parent c70c1d54f4
commit 8632614947

View File

@ -143,7 +143,7 @@ QSslCertificate::QSslCertificate(QIODevice *device, QSsl::EncodingFormat format)
: d(new QSslCertificatePrivate)
{
QSslSocketPrivate::ensureInitialized();
if (device)
if (device && QSslSocket::supportsSsl())
d->init(device->readAll(), format);
}
@ -157,7 +157,8 @@ QSslCertificate::QSslCertificate(const QByteArray &data, QSsl::EncodingFormat fo
: d(new QSslCertificatePrivate)
{
QSslSocketPrivate::ensureInitialized();
d->init(data, format);
if (QSslSocket::supportsSsl())
d->init(data, format);
}
/*!