Remove redundant null-checks for pointer deletion

Deleting a null pointer is defined behavior and results in a no-op at
the assembly level, so it's perfectly safe.
This commit is contained in:
Gianluca Recchia 2018-10-28 11:39:15 +01:00
parent 4ac1601696
commit 18fd20f898
No known key found for this signature in database
GPG Key ID: 3C2B4128D9A1F218
2 changed files with 8 additions and 8 deletions

View File

@ -195,9 +195,9 @@ void DatabaseOpenWidget::openDatabase()
MessageWidget::Error);
return;
}
if (m_db) {
delete m_db;
}
delete m_db;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_db = reader.readDatabase(&file, masterKey);
QApplication::restoreOverrideCursor();

View File

@ -53,9 +53,9 @@ void KeePass1OpenWidget::openDatabase()
MessageWidget::Error);
return;
}
if (m_db) {
delete m_db;
}
delete m_db;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_db = reader.readDatabase(&file, password, keyFileName);
QApplication::restoreOverrideCursor();