From 868d499f8dbc6ec0b1d778695cff8b499f09cbc4 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Mon, 14 Sep 2020 08:21:04 +0200 Subject: [PATCH] Return when selection is empty --- src/standardmailactionmanager.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/standardmailactionmanager.cpp b/src/standardmailactionmanager.cpp index 61c222b..8cc755e 100644 --- a/src/standardmailactionmanager.cpp +++ b/src/standardmailactionmanager.cpp @@ -485,14 +485,15 @@ public: void slotMarkAs() { - const QAction *action = qobject_cast(mParent->sender()); - Q_ASSERT(action); - const Akonadi::Item::List items = mGenericManager->selectedItems(); if (items.isEmpty()) { return; } + const QAction *action = qobject_cast(mParent->sender()); + Q_ASSERT(action); + + QByteArray typeStr = action->data().toByteArray(); qCDebug(AKONADIMIME_LOG) << "Mark mail as: " << typeStr; @@ -526,16 +527,17 @@ public: void slotMarkAllAs() { + const Akonadi::Collection::List collections = mGenericManager->selectedCollections(); + if (collections.isEmpty()) { + return; + } + const QAction *action = qobject_cast(mParent->sender()); Q_ASSERT(action); QByteArray typeStr = action->data().toByteArray(); qCDebug(AKONADIMIME_LOG) << "Mark all as: " << typeStr; - const Akonadi::Collection::List collections = mGenericManager->selectedCollections(); - if (collections.isEmpty()) { - return; - } Akonadi::MessageStatus targetStatus; targetStatus.setStatusFromStr(QLatin1String(typeStr)); -- GitLab