Check for errors in KdeConnectConfig

This commit is contained in:
Albert Vaca Cintora 2023-07-15 22:10:53 +02:00
parent 675d1c1262
commit 70f6ebf6d5

View file

@ -296,6 +296,10 @@ void KdeConnectConfig::generatePrivateKey(const QString &keyPath)
qCDebug(KDECONNECT_CORE) << "Generating private key";
d->m_privateKey = SslHelper::generateRsaPrivateKey();
if (d->m_privateKey.isNull()) {
qCritical() << "Could not generate the private key";
Daemon::instance()->reportError(i18n("KDE Connect failed to start"), i18n("Could not generate the private key."));
}
QFile privKey(keyPath);
bool error = false;
@ -323,6 +327,10 @@ void KdeConnectConfig::generateCertificate(const QString &certPath)
qCDebug(KDECONNECT_CORE) << "My id:" << uuid;
d->m_certificate = SslHelper::generateSelfSignedCertificate(d->m_privateKey, uuid);
if (d->m_certificate.isNull()) {
qCritical() << "Could not generate a certificate";
Daemon::instance()->reportError(i18n("KDE Connect failed to start"), i18n("Could not generate the device certificate."));
}
QFile cert(certPath);
bool error = false;