[folks] telepathy: Handle null account managers



commit 49218e6d2918ce5b60b9698f812ad52f0be94812
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Mar 26 20:16:00 2012 +0100

    telepathy: Handle null account managers
    
    This can occur in the tests when using persona stores which haven't been
    prepare()d at all.

 backends/telepathy/lib/tpf-persona-store.vala |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 423d07e..f72ce75 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -95,7 +95,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
   private Channel _stored;
   private Channel _subscribe;
   private Connection _conn;
-  private AccountManager _account_manager;
+  private AccountManager? _account_manager; /* only null before prepare() */
   private Logger _logger;
   private Contact? _self_contact;
   private MaybeBool _can_add_personas = MaybeBool.UNSET;
@@ -298,8 +298,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
         this._logger.invalidated.disconnect (this._logger_invalidated_cb);
 
       this._account.invalidated.disconnect (this._account_invalidated_cb);
-      this._account_manager.invalidated.disconnect (
-          this._account_manager_invalidated_cb);
+
+      if (this._account_manager != null)
+        {
+          this._account_manager.invalidated.disconnect (
+              this._account_manager_invalidated_cb);
+          this._account_manager = null;
+        }
     }
 
   private string _format_maybe_bool (MaybeBool input)



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