Skip to content

Commit 46c3eee

Browse files
authored
Improve kwallet verification. By @samuel-w (#889)
1 parent 8da81e7 commit 46c3eee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/vorta/keyring/kwallet.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self):
2020
self.object_path,
2121
self.interface_name,
2222
QtDBus.QDBusConnection.sessionBus())
23-
if not (self.iface.isValid() and self.get_result("isEnabled")):
23+
if not (self.iface.isValid() and self.get_result("isEnabled") is True):
2424
raise KWalletNotAvailableException
2525

2626
def set_password(self, service, repo_url, password):
@@ -49,7 +49,10 @@ def try_unlock(self):
4949
wId = QVariant(0)
5050
wId.convert(4)
5151
output = self.get_result("open", args=[wallet_name, wId, 'vorta-repo'])
52-
self.handle = int(output)
52+
try:
53+
self.handle = int(output)
54+
except ValueError: # For when kwallet is disabled or dbus otherwise broken
55+
return -2
5356

5457

5558
class KWalletNotAvailableException(Exception):

0 commit comments

Comments
 (0)