fix crash when mapping unified mailboxes to collections

Summary:
when the fetched unified mailbox collections and loaded mailboxes differ then
trying to get a loaded mailbox using the collection name may fail.
wrapping the call in a try-catch block fixes the crash

Reviewers: dvratil, mlaurent

Reviewed By: mlaurent

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D19323
wilder
Jan Hambrecht 7 years ago
parent 9267ab7ca1
commit 2f6f2bab05
  1. 8
      agents/unifiedmailboxagent/unifiedmailboxmanager.cpp

@ -388,8 +388,12 @@ void UnifiedMailboxManager::discoverBoxCollections(FinishedCallback &&finishedCb
if (!isUnifiedMailbox(col) || col.parentCollection() == Akonadi::Collection::root()) {
continue;
}
mMailboxes.at(col.name())->setCollectionId(col.id());
const auto it = mMailboxes.find(col.name());
if (it == mMailboxes.end()) {
qCWarning(UNIFIEDMAILBOXAGENT_LOG) << "Failed to find an unified mailbox for source collection" << col.id();
} else {
it->second->setCollectionId(col.id());
}
}
});
if (finishedCb) {

Loading…
Cancel
Save