mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Correct checks for containers' emptiness
This commit is contained in:
parent
fc930bae69
commit
e81841550b
@ -403,10 +403,11 @@ QString CsvParser::getStatus() const
|
|||||||
|
|
||||||
int CsvParser::getCsvCols() const
|
int CsvParser::getCsvCols() const
|
||||||
{
|
{
|
||||||
if ((m_table.size() > 0) && (m_table.at(0).size() > 0))
|
if (!m_table.isEmpty() && !m_table.at(0).isEmpty()) {
|
||||||
return m_table.at(0).size();
|
return m_table.at(0).size();
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CsvParser::getCsvRows() const
|
int CsvParser::getCsvRows() const
|
||||||
|
@ -731,7 +731,7 @@ Entry* KdbxXmlReader::parseEntry(bool history)
|
|||||||
}
|
}
|
||||||
if (m_xml.name() == "Binary") {
|
if (m_xml.name() == "Binary") {
|
||||||
QPair<QString, QString> ref = parseEntryBinary(entry);
|
QPair<QString, QString> ref = parseEntryBinary(entry);
|
||||||
if (!ref.first.isNull() && !ref.second.isNull()) {
|
if (!ref.first.isEmpty() && !ref.second.isEmpty()) {
|
||||||
binaryRefs.append(ref);
|
binaryRefs.append(ref);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -174,7 +174,7 @@ QSharedPointer<Database> DatabaseOpenWidget::database()
|
|||||||
|
|
||||||
void DatabaseOpenWidget::enterKey(const QString& pw, const QString& keyFile)
|
void DatabaseOpenWidget::enterKey(const QString& pw, const QString& keyFile)
|
||||||
{
|
{
|
||||||
if (!pw.isNull()) {
|
if (!pw.isEmpty()) {
|
||||||
m_ui->editPassword->setText(pw);
|
m_ui->editPassword->setText(pw);
|
||||||
}
|
}
|
||||||
if (!keyFile.isEmpty()) {
|
if (!keyFile.isEmpty()) {
|
||||||
|
@ -220,7 +220,7 @@ void EntryPreviewWidget::updateEntryAttributesTab()
|
|||||||
m_ui->entryAttributesEdit->clear();
|
m_ui->entryAttributesEdit->clear();
|
||||||
const EntryAttributes* attributes = m_currentEntry->attributes();
|
const EntryAttributes* attributes = m_currentEntry->attributes();
|
||||||
const QStringList customAttributes = attributes->customKeys();
|
const QStringList customAttributes = attributes->customKeys();
|
||||||
const bool haveAttributes = customAttributes.size() > 0;
|
const bool haveAttributes = !customAttributes.isEmpty();
|
||||||
setTabEnabled(m_ui->entryTabWidget, m_ui->entryAttributesTab, haveAttributes);
|
setTabEnabled(m_ui->entryTabWidget, m_ui->entryAttributesTab, haveAttributes);
|
||||||
if (haveAttributes) {
|
if (haveAttributes) {
|
||||||
QString attributesText;
|
QString attributesText;
|
||||||
|
@ -267,7 +267,7 @@ void TestKeePass1Reader::reopenDatabase(QSharedPointer<Database> db,
|
|||||||
QVERIFY(buffer.seek(0));
|
QVERIFY(buffer.seek(0));
|
||||||
|
|
||||||
auto key = QSharedPointer<CompositeKey>::create();
|
auto key = QSharedPointer<CompositeKey>::create();
|
||||||
if (!password.isNull()) {
|
if (!password.isEmpty()) {
|
||||||
key->addKey(QSharedPointer<PasswordKey>::create(password));
|
key->addKey(QSharedPointer<PasswordKey>::create(password));
|
||||||
}
|
}
|
||||||
if (!keyfileName.isEmpty()) {
|
if (!keyfileName.isEmpty()) {
|
||||||
|
@ -227,7 +227,7 @@ void TestKeys::testCompositeKeyComponents()
|
|||||||
auto fileKeyEnc = QSharedPointer<FileKey>::create();
|
auto fileKeyEnc = QSharedPointer<FileKey>::create();
|
||||||
QString error;
|
QString error;
|
||||||
fileKeyEnc->load(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed.key"), &error);
|
fileKeyEnc->load(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed.key"), &error);
|
||||||
if (!error.isNull()) {
|
if (!error.isEmpty()) {
|
||||||
QFAIL(qPrintable(error));
|
QFAIL(qPrintable(error));
|
||||||
}
|
}
|
||||||
auto challengeResponseKeyEnc = QSharedPointer<MockChallengeResponseKey>::create(QByteArray(16, 0x10));
|
auto challengeResponseKeyEnc = QSharedPointer<MockChallengeResponseKey>::create(QByteArray(16, 0x10));
|
||||||
@ -285,7 +285,7 @@ void TestKeys::testCompositeKeyComponents()
|
|||||||
compositeKeyDec3->addKey(passwordKeyEnc);
|
compositeKeyDec3->addKey(passwordKeyEnc);
|
||||||
auto fileKeyWrong = QSharedPointer<FileKey>::create();
|
auto fileKeyWrong = QSharedPointer<FileKey>::create();
|
||||||
fileKeyWrong->load(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed2.key"), &error);
|
fileKeyWrong->load(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed2.key"), &error);
|
||||||
if (!error.isNull()) {
|
if (!error.isEmpty()) {
|
||||||
QFAIL(qPrintable(error));
|
QFAIL(qPrintable(error));
|
||||||
}
|
}
|
||||||
compositeKeyDec3->addKey(fileKeyWrong);
|
compositeKeyDec3->addKey(fileKeyWrong);
|
||||||
|
Loading…
Reference in New Issue
Block a user