Check if a database is present before trying to create the CopyAttributesMenu.

Closes #50
This commit is contained in:
Florian Geyer 2012-11-10 18:46:01 +01:00
parent e85dbda62a
commit 50148e9640

View File

@ -205,12 +205,15 @@ void MainWindow::updateLastDatabasesMenu()
void MainWindow::updateCopyAttributesMenu()
{
m_ui->menuEntryCopyAttribute->clear();
DatabaseWidget* dbWidget = m_ui->tabWidget->currentDatabaseWidget();
Q_ASSERT(dbWidget);
Q_ASSERT(dbWidget->entryView()->isSingleEntrySelected());
if (!dbWidget) {
return;
}
if (!dbWidget->entryView()->isSingleEntrySelected()) {
return;
}
m_ui->menuEntryCopyAttribute->clear();
Entry* entry = dbWidget->entryView()->currentEntry();
Q_FOREACH (const QString& key, EntryAttributes::DefaultAttributes) {