From 0d3a3e9df836b1b7405d39cfdb2dc3eae4ab662a Mon Sep 17 00:00:00 2001 From: vuurvlieg Date: Mon, 25 Mar 2024 15:08:13 +0100 Subject: [PATCH] Correct overzealous refactor --- src/core/Entry.cpp | 4 +++- src/core/Group.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index cf1c504a0..3ab2839d8 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -1267,7 +1267,9 @@ void Entry::setGroup(Group* group, bool trackPrevious) m_group->database()->addDeletedObject(m_uuid); // copy custom icon to the new database - group->database()->metadata()->copyCustomIcon(iconUuid(), m_group->database()->metadata()); + if (group->database()) { + group->database()->metadata()->copyCustomIcon(iconUuid(), m_group->database()->metadata()); + } } else if (trackPrevious && m_group->database() && group != m_group) { setPreviousParentGroup(m_group); } diff --git a/src/core/Group.cpp b/src/core/Group.cpp index d1df6e94c..c217a0e82 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -469,7 +469,9 @@ void Group::setParent(Group* parent, int index, bool trackPrevious) recCreateDelObjects(); // copy custom icon to the new database - parent->m_db->metadata()->copyCustomIcon(iconUuid(), m_db->metadata()); + if (parent->m_db) { + parent->m_db->metadata()->copyCustomIcon(iconUuid(), m_db->metadata()); + } } if (m_db != parent->m_db) { connectDatabaseSignalsRecursive(parent->m_db);