1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

more file open checking

This commit is contained in:
Dubslow 2014-12-09 18:08:38 -06:00
parent 0e21a8d497
commit 31c072d296
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA

View File

@ -105,7 +105,11 @@ bool Core::isPasswordSet(PasswordType passtype)
QByteArray Core::getSaltFromFile(QString filename)
{
QFile file(filename);
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly))
{
qWarning() << "Core: encrypted history file doesn't exist";
return QByteArray();
}
QByteArray data = file.read(tox_pass_encryption_extra_length());
file.close();
@ -173,7 +177,7 @@ void Core::checkEncryptedHistory()
if (salt.size() == 0)
{ // maybe we should handle this better
Widget::getInstance()->showWarningMsgBox(tr("Encrypted History"), tr("No encrypted history file found.\nHistory will be disabled!"));
Widget::getInstance()->showWarningMsgBox(tr("Encrypted History"), tr("No encrypted history file found, or it was corrupted.\nHistory will be disabled!"));
Settings::getInstance().setEncryptLogs(false);
Settings::getInstance().setEnableLogging(false);
return;