File fix-isOpen-crash-when-wallet-disabled.patch of Package kwallet

From: Wolfgang Bauer <wbauer@tmo.at>
Date: Sat, 01 Oct 2016 09:43:23 +0000
Subject: Check whether kwallet is enabled in Wallet::isOpen(name)
X-Git-Tag: v5.27.0-rc1
X-Git-Url: http://quickgit.kde.org/?p=kwallet.git&a=commitdiff&h=48ec969bcf36fde17de027576859c98bae609c73
---
Check whether kwallet is enabled in Wallet::isOpen(name)

If kwallet is disabled, walletlauncher() fails to start the service and
walletLauncher()->getInterface().isOpen(name) causes a crash.
This affects e.g. drkonqi, but probably also other applications.

Return false in this case, if kwallet is disabled a wallet cannot be
open either.

BUG: 358260
FIXED-IN: 5.27.0
REVIEW: 128831
---


--- a/src/api/KWallet/kwallet.cpp
+++ b/src/api/KWallet/kwallet.cpp
@@ -363,14 +363,16 @@
         }
     } else {
 #endif
-        QDBusReply<bool> r = walletLauncher()->getInterface().isOpen(name);
-
-        if (!r.isValid()) {
-            qDebug() << "Invalid DBus reply: " << r.error();
-            return false;
-        } else {
-            return r;
-        }
+        if (walletLauncher()->m_walletEnabled) {
+            QDBusReply<bool> r = walletLauncher()->getInterface().isOpen(name);
+
+            if (!r.isValid()) {
+                qDebug() << "Invalid DBus reply: " << r.error();
+                return false;
+            } else {
+                return r;
+            }
+        } else return false;
 #if HAVE_KSECRETSSERVICE
     }
 #endif

openSUSE Build Service is sponsored by