From 5c51d116514578fa35f64a4aeea09a9b132d779b Mon Sep 17 00:00:00 2001 From: Nick Spain Date: Tue, 13 Feb 2018 00:11:26 +1100 Subject: [PATCH] Fix Issue #1447 by using entry's group when not creating entry --- src/gui/DatabaseWidget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index cd57f629..23760668 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -819,7 +819,16 @@ void DatabaseWidget::switchToEntryEdit(Entry* entry) void DatabaseWidget::switchToEntryEdit(Entry* entry, bool create) { - Group* group = currentGroup(); + // If creating an entry, it will be in `currentGroup()` so it's + // okay to use but when editing, the entry may not be in + // `currentGroup()` so we get the entry's group. + Group* group; + if (create) { + group = currentGroup(); + } else { + group = entry->group(); + } + Q_ASSERT(group); m_editEntryWidget->loadEntry(entry, create, false, group->name(), m_db);