Commit 53ed9a56 authored by David Faure's avatar David Faure

Fix assert when deleting a folder in kmail

MessageList::Pane::Private::setCurrentFolder ends up calling
StorageModel::savePreSelectedMessage for the old folder, usually in
order to save the current message in that folder. But if we just deleted
that folder (and that's the reason we're "moving away" from it), then
it's not selected anymore and StorageModel::id() returns empty.

Just return early from savePreSelectedMessage in that case.
parent 150546da
Pipeline #42337 passed with stage
in 28 minutes and 35 seconds
......@@ -43,7 +43,10 @@ unsigned long StorageModel::preSelectedMessage() const
void StorageModel::savePreSelectedMessage(unsigned long uniqueIdOfMessage)
{
const QString storageModelId = id();
Q_ASSERT(!storageModelId.isEmpty());
if (storageModelId.isEmpty()) {
// This happens when deleting a collection, and this is called when switching away from it
return;
}
KConfigGroup conf(MessageListSettings::self()->config(),
MessageList::Util::storageModelSelectedMessageGroup());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment