telepathy: Handle null account managers
authorPhilip Withnall <philip@tecnocode.co.uk>
Mon, 26 Mar 2012 19:16:00 +0000 (20:16 +0100)
committerPhilip Withnall <philip@tecnocode.co.uk>
Mon, 26 Mar 2012 22:20:57 +0000 (23:20 +0100)
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

index 423d07e..f72ce75 100644 (file)
@@ -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)