Import error reporting

I was getting a crash, it was because of a set up problem, but having this
helped me to figure it out.
This commit is contained in:
Aleix Pol 2014-09-01 17:49:09 +02:00
parent 16f2251019
commit e82850411d

View file

@ -86,8 +86,13 @@ void Device::initPrivateKey()
//TODO: It is redundant to have our own private key in every instance of Device, move this to a singleton somewhere (Daemon?)
const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true);
QFile privKey(privateKeyPath);
privKey.open(QIODevice::ReadOnly);
m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll());
if (privKey.open(QIODevice::ReadOnly))
m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll());
else {
qWarning() << "Could not open the private key" << privateKeyPath;
}
Q_ASSERT(!m_privateKey.isNull());
}
Device::~Device()