[geary/wip/795328-null-secret-colection: 2/2] Fix crash if the login session's secret service has no password keyring.



commit 703bb094b3e04cb261e56b5dbe9d6559a51b0224
Author: Michael James Gratton <mike vee net>
Date:   Fri Apr 27 13:46:29 2018 +1000

    Fix crash if the login session's secret service has no password keyring.
    
    Bug 795328.

 src/client/application/secret-mediator.vala |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/secret-mediator.vala b/src/client/application/secret-mediator.vala
index 57215d5..8e80ea8 100644
--- a/src/client/application/secret-mediator.vala
+++ b/src/client/application/secret-mediator.vala
@@ -162,13 +162,19 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
         Secret.Service service = yield Secret.Service.get(
             Secret.ServiceFlags.OPEN_SESSION, cancellable
         );
-        Secret.Collection collection = yield Secret.Collection.for_alias(
+        Secret.Collection? collection = yield Secret.Collection.for_alias(
             service,
             Secret.COLLECTION_DEFAULT,
             Secret.CollectionFlags.NONE,
             cancellable
         );
-        if (collection.get_locked()) {
+
+        // For custom desktop setups, it is possible that the current
+        // session has a service responding on DBus but no password
+        // keyring. There's no much we can do in this case except just
+        // check for the collection being null so we don't crash. See
+        // Bug 795328.
+        if (collection != null && collection.get_locked()) {
             List<Secret.Collection> to_lock = new List<Secret.Collection>();
             to_lock.append(collection);
             List<DBusProxy> unlocked;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]