[pim/pimcommon] src/pimcommon/shareserviceurl: Make sure that we can convert type.

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 5efa20e6e5929cb2aa0404baa9c41378af75ed27 by Laurent Montel.
Committed on 14/08/2026 at 21:33.
Pushed by mlaurent into branch 'master'.

Make sure that we can convert type.

Otherwise it fallbacks to 0 => facebook.
It's not a good idea

M  +5    -2    src/pimcommon/shareserviceurl/shareserviceurlmanager.cpp

https://invent.kde.org/pim/pimcommon/-/commit/5efa20e6e5929cb2aa0404baa9c41378af75ed27

diff --git a/src/pimcommon/shareserviceurl/shareserviceurlmanager.cpp b/src/pimcommon/shareserviceurl/shareserviceurlmanager.cpp
index 1d444dcd..e6958514 100644
--- a/src/pimcommon/shareserviceurl/shareserviceurlmanager.cpp
+++ b/src/pimcommon/shareserviceurl/shareserviceurlmanager.cpp
@@ -120,8 +120,11 @@ KActionMenu *ShareServiceUrlManager::menu() const
 void ShareServiceUrlManager::slotSelectServiceUrl(QAction *act)
 {
     if (act) {
-        const auto type = act->data().value<PimCommon::ShareServiceUrlManager::ServiceType>();
-        Q_EMIT serviceUrlSelected(type);
+        const QVariant data = act->data();
+        if (data.canConvert<ServiceType>()) {
+            const auto type = data.value<PimCommon::ShareServiceUrlManager::ServiceType>();
+            Q_EMIT serviceUrlSelected(type);
+        }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.