From 31c072d29658dad1adb3b3cb3909fc1d18835a9b Mon Sep 17 00:00:00 2001 From: Dubslow Date: Tue, 9 Dec 2014 18:08:38 -0600 Subject: [PATCH] more file open checking --- src/coreencryption.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/coreencryption.cpp b/src/coreencryption.cpp index c1c15649f..5760a8ba6 100644 --- a/src/coreencryption.cpp +++ b/src/coreencryption.cpp @@ -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;