From 50148e96402011be54395fe52d124046ee0f089d Mon Sep 17 00:00:00 2001 From: Florian Geyer Date: Sat, 10 Nov 2012 18:46:01 +0100 Subject: [PATCH] Check if a database is present before trying to create the CopyAttributesMenu. Closes #50 --- src/gui/MainWindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 9327ab755..18fdd281b 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -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) {