]> git.0d.be Git - empathy.git/commitdiff
Don't assume that all TpfPersonas contain valid TpContacts
authorTravis Reitter <travis.reitter@collabora.co.uk>
Mon, 27 Jun 2011 21:31:25 +0000 (14:31 -0700)
committerJonny Lamb <jonnylamb@gnome.org>
Mon, 22 Aug 2011 09:36:33 +0000 (10:36 +0100)
Helps: bgo#653599 - Empathy shouldn't assume all TpfPersonas contain a
valid TpContact

Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
libempathy-gtk/empathy-individual-dialogs.c
libempathy-gtk/empathy-individual-menu.c
libempathy-gtk/empathy-individual-store.c
libempathy-gtk/empathy-individual-widget.c
libempathy-gtk/empathy-persona-store.c
libempathy-gtk/empathy-persona-view.c
libempathy/empathy-contact.c
libempathy/empathy-individual-manager.c
libempathy/empathy-utils.c

index a19787662e015ce2fa56b08cc671c399cd30a530..e1bd6f11fc173bd643a5dfcf657387173c4d1c05 100644 (file)
@@ -222,6 +222,9 @@ empathy_block_individual_dialog_show (GtkWindow *parent,
           goto while_finish;
 
       contact = tpf_persona_get_contact (persona);
+      if (contact == NULL)
+        goto while_finish;
+
       flags = empathy_contact_manager_get_flags_for_connection (
           contact_manager, tp_contact_get_connection (contact));
 
index 6131bfdfd6035a33f421635274200cb38ffe81e6..eab28ec876c163a7b6c84b5f105165697bc0c62e 100644 (file)
@@ -127,6 +127,9 @@ individual_menu_add_personas (GtkMenuShell *menu,
         goto while_finish;
 
       tp_contact = tpf_persona_get_contact (persona);
+      if (tp_contact == NULL)
+        goto while_finish;
+
       contact = empathy_contact_dup_from_tp_contact (tp_contact);
 
       store = folks_persona_get_store (FOLKS_PERSONA (persona));
@@ -1038,17 +1041,20 @@ room_sub_menu_activate_cb (GtkWidget *item,
           if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona)))
             {
               tp_contact = tpf_persona_get_contact (persona);
-              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              if (tp_contact != NULL)
+                {
+                  contact = empathy_contact_dup_from_tp_contact (tp_contact);
 
-              rooms = empathy_chatroom_manager_get_chatrooms (mgr,
-                  empathy_contact_get_account (contact));
+                  rooms = empathy_chatroom_manager_get_chatrooms (mgr,
+                      empathy_contact_get_account (contact));
 
-              if (g_list_find (rooms, data->chatroom) == NULL)
-                g_clear_object (&contact);
+                  if (g_list_find (rooms, data->chatroom) == NULL)
+                    g_clear_object (&contact);
 
-              /* if contact != NULL here, we've found our match */
+                  /* if contact != NULL here, we've found our match */
 
-              g_list_free (rooms);
+                  g_list_free (rooms);
+                }
             }
           g_clear_object (&persona);
         }
@@ -1143,13 +1149,17 @@ empathy_individual_invite_menu_item_new (FolksIndividual *individual,
           if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona)))
             {
               tp_contact = tpf_persona_get_contact (persona);
-              contact_cur = empathy_contact_dup_from_tp_contact (tp_contact);
+              if (tp_contact != NULL)
+                {
+                  contact_cur = empathy_contact_dup_from_tp_contact (
+                      tp_contact);
 
-              rooms_cur = empathy_chatroom_manager_get_chatrooms (mgr,
-                  empathy_contact_get_account (contact_cur));
-              rooms = g_list_concat (rooms, rooms_cur);
+                  rooms_cur = empathy_chatroom_manager_get_chatrooms (mgr,
+                      empathy_contact_get_account (contact_cur));
+                  rooms = g_list_concat (rooms, rooms_cur);
 
-              g_object_unref (contact_cur);
+                  g_object_unref (contact_cur);
+                }
             }
           g_clear_object (&persona);
         }
index e4e644424533c6acf643ab65be5ac95f9a478b67..4bdded80b39f219a1140100afd236d56c5e4c6e8 100644 (file)
@@ -133,21 +133,25 @@ individual_can_audio_video_call (FolksIndividual *individual,
     {
       FolksPersona *persona = gee_iterator_get (iter);
       TpContact *tp_contact;
-      EmpathyContact *contact;
 
       if (!empathy_folks_persona_is_interesting (persona))
         goto while_finish;
 
       tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
-      contact = empathy_contact_dup_from_tp_contact (tp_contact);
-      empathy_contact_set_persona (contact, persona);
+      if (tp_contact != NULL)
+        {
+          EmpathyContact *contact;
+
+          contact = empathy_contact_dup_from_tp_contact (tp_contact);
+          empathy_contact_set_persona (contact, persona);
 
-      can_audio = can_audio || empathy_contact_get_capabilities (contact) &
-          EMPATHY_CAPABILITIES_AUDIO;
-      can_video = can_video || empathy_contact_get_capabilities (contact) &
-          EMPATHY_CAPABILITIES_VIDEO;
+          can_audio = can_audio || empathy_contact_get_capabilities (contact) &
+              EMPATHY_CAPABILITIES_AUDIO;
+          can_video = can_video || empathy_contact_get_capabilities (contact) &
+              EMPATHY_CAPABILITIES_VIDEO;
 
-      g_object_unref (contact);
+          g_object_unref (contact);
+        }
 while_finish:
       g_clear_object (&persona);
 
@@ -190,7 +194,8 @@ individual_get_client_types (FolksIndividual *individual)
           presence_type = folks_presence_details_get_presence_type (presence);
 
           tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
-          types = tp_contact_get_client_types (tp_contact);
+          if (tp_contact != NULL)
+            types = tp_contact_get_client_types (tp_contact);
         }
 
 while_finish:
@@ -900,14 +905,17 @@ individual_personas_changed_cb (FolksIndividual *individual,
       if (TPF_IS_PERSONA (persona))
         {
           tp_contact = tpf_persona_get_contact (persona);
-          contact = empathy_contact_dup_from_tp_contact (tp_contact);
-          empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
+          if (tp_contact != NULL)
+            {
+              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
 
-          g_object_set_data (G_OBJECT (contact), "individual", NULL);
-          g_signal_handlers_disconnect_by_func (contact,
-              (GCallback) individual_store_contact_updated_cb, self);
+              g_object_set_data (G_OBJECT (contact), "individual", NULL);
+              g_signal_handlers_disconnect_by_func (contact,
+                  (GCallback) individual_store_contact_updated_cb, self);
 
-          g_object_unref (contact);
+              g_object_unref (contact);
+            }
         }
 
       g_clear_object (&persona);
@@ -924,16 +932,19 @@ individual_personas_changed_cb (FolksIndividual *individual,
       if (TPF_IS_PERSONA (persona))
         {
           tp_contact = tpf_persona_get_contact (persona);
-          contact = empathy_contact_dup_from_tp_contact (tp_contact);
-          empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
+          if (tp_contact != NULL)
+            {
+              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
 
-          g_object_set_data (G_OBJECT (contact), "individual", individual);
-          g_signal_connect (contact, "notify::capabilities",
-              (GCallback) individual_store_contact_updated_cb, self);
-          g_signal_connect (contact, "notify::client-types",
-              (GCallback) individual_store_contact_updated_cb, self);
+              g_object_set_data (G_OBJECT (contact), "individual", individual);
+              g_signal_connect (contact, "notify::capabilities",
+                  (GCallback) individual_store_contact_updated_cb, self);
+              g_signal_connect (contact, "notify::client-types",
+                  (GCallback) individual_store_contact_updated_cb, self);
 
-          g_object_unref (contact);
+              g_object_unref (contact);
+            }
         }
 
       g_clear_object (&persona);
index fcc076b9b324dfdbd6439cfecb9213c3c7fdc826..0a3844aa23a0377f6ca92570e373d70b0dc295d6 100644 (file)
@@ -574,16 +574,20 @@ location_update (EmpathyIndividualWidget *self)
            * have to keep it alive for the duration of the function, since we're
            * accessing its private data. */
           tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
-          contact = empathy_contact_dup_from_tp_contact (tp_contact);
-          empathy_contact_set_persona (contact, persona);
-
-          /* Try and get a location */
-          location = empathy_contact_get_location (contact);
-          /* if location isn't fully valid, treat the contact as insufficient */
-          if (location != NULL && g_hash_table_size (location) <= 0)
+          if (tp_contact != NULL)
             {
-              location = NULL;
-              g_clear_object (&contact);
+              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              empathy_contact_set_persona (contact, persona);
+
+              /* Try and get a location */
+              location = empathy_contact_get_location (contact);
+              /* if location isn't fully valid, treat the contact as
+               * insufficient */
+              if (location != NULL && g_hash_table_size (location) <= 0)
+                {
+                  location = NULL;
+                  g_clear_object (&contact);
+                }
             }
         }
       g_clear_object (&persona);
@@ -747,6 +751,9 @@ location_update (EmpathyIndividualWidget *self)
 
               /* Get the contact */
               tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+              if (tp_contact == NULL)
+                goto while_finish;
+
               contact = empathy_contact_dup_from_tp_contact (tp_contact);
               empathy_contact_set_persona (contact, persona);
 
@@ -856,6 +863,9 @@ persona_dup_avatar (FolksPersona *persona)
     return NULL;
 
   tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+  if (tp_contact == NULL)
+    return NULL;
+
   contact = empathy_contact_dup_from_tp_contact (tp_contact);
   empathy_contact_set_persona (contact, persona);
 
@@ -1063,16 +1073,19 @@ individual_is_user (FolksIndividual *individual)
       if (TPF_IS_PERSONA (persona))
         {
           TpContact *tp_contact;
-          EmpathyContact *contact;
+          EmpathyContact *contact = NULL;
 
           /* Get the contact */
           tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
-          contact = empathy_contact_dup_from_tp_contact (tp_contact);
-          empathy_contact_set_persona (contact, persona);
+          if (tp_contact != NULL)
+            {
+              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              empathy_contact_set_persona (contact, persona);
 
-          /* Determine if the contact is the user */
-          if (empathy_contact_is_user (contact))
-            retval = g_object_ref (empathy_contact_get_account (contact));
+              /* Determine if the contact is the user */
+              if (empathy_contact_is_user (contact))
+                retval = g_object_ref (empathy_contact_get_account (contact));
+            }
 
           g_object_unref (contact);
         }
@@ -1409,6 +1422,9 @@ update_persona (EmpathyIndividualWidget *self, FolksPersona *persona)
   g_assert (table != NULL);
 
   tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+  if (tp_contact == NULL)
+    return;
+
   contact = empathy_contact_dup_from_tp_contact (tp_contact);
   empathy_contact_set_persona (contact, persona);
 
index a3877788ba91f91fe915861475140aa9aed3a664..70d53b3c1581194f283ab04a8859f14e682275ab 100644 (file)
@@ -278,6 +278,7 @@ add_persona (EmpathyPersonaStore *self,
   GtkTreeIter iter;
   GtkTreePath *path;
   FolksPersonaStore *store;
+  TpContact *tp_contact;
   EmpathyContact *contact;
   const gchar *alias;
 
@@ -290,8 +291,11 @@ add_persona (EmpathyPersonaStore *self,
   if (EMP_STR_EMPTY (alias))
     return;
 
-  contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact (
-      TPF_PERSONA (persona)));
+  tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+  if (tp_contact == NULL)
+    return;
+
+  contact = empathy_contact_dup_from_tp_contact (tp_contact);
   store = folks_persona_get_store (persona);
 
   gtk_list_store_insert_with_values (GTK_LIST_STORE (self), &iter, 0,
@@ -348,14 +352,18 @@ get_persona_status_icon (EmpathyPersonaStore *self,
     FolksPersona *persona)
 {
   EmpathyPersonaStorePriv *priv = GET_PRIV (self);
+  TpContact *tp_contact;
   EmpathyContact *contact;
   const gchar *protocol_name = NULL;
   gchar *icon_name = NULL;
   GdkPixbuf *pixbuf_status = NULL;
   const gchar *status_icon_name = NULL;
 
-  contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact (
-      TPF_PERSONA (persona)));
+  tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+  if (tp_contact == NULL)
+    return NULL;
+
+  contact = empathy_contact_dup_from_tp_contact (tp_contact);
 
   status_icon_name = empathy_icon_name_for_contact (contact);
   if (status_icon_name == NULL)
@@ -422,9 +430,10 @@ update_persona (EmpathyPersonaStore *self,
   else
     {
       FolksPersonaStore *store;
+      TpContact *tp_contact;
       EmpathyContact *contact;
       GtkTreeIter iter;
-      GdkPixbuf *pixbuf_avatar;
+      GdkPixbuf *pixbuf_avatar = NULL;
       GdkPixbuf *pixbuf_status;
       gboolean now_online = FALSE;
       gboolean was_online = TRUE;
@@ -464,39 +473,43 @@ update_persona (EmpathyPersonaStore *self,
         }
 
       /* We still need to use EmpathyContact for the capabilities stuff */
-      contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact (
-          TPF_PERSONA (persona)));
-      store = folks_persona_get_store (persona);
-
-      pixbuf_avatar = empathy_pixbuf_avatar_from_contact_scaled (contact,
-          32, 32);
-      pixbuf_status = get_persona_status_icon (self, persona);
-
-      gtk_list_store_set (GTK_LIST_STORE (self), &iter,
-          EMPATHY_PERSONA_STORE_COL_ICON_STATUS, pixbuf_status,
-          EMPATHY_PERSONA_STORE_COL_PIXBUF_AVATAR, pixbuf_avatar,
-          EMPATHY_PERSONA_STORE_COL_PIXBUF_AVATAR_VISIBLE, priv->show_avatars,
-          EMPATHY_PERSONA_STORE_COL_NAME, alias,
-          EMPATHY_PERSONA_STORE_COL_ACCOUNT_NAME,
-              folks_persona_store_get_display_name (store),
-          EMPATHY_PERSONA_STORE_COL_DISPLAY_ID,
-              folks_persona_get_display_id (persona),
-          EMPATHY_PERSONA_STORE_COL_PRESENCE_TYPE,
-              folks_presence_details_get_presence_type (
-                  FOLKS_PRESENCE_DETAILS (persona)),
-          EMPATHY_PERSONA_STORE_COL_STATUS,
-              folks_presence_details_get_presence_message (
-                  FOLKS_PRESENCE_DETAILS (persona)),
-          EMPATHY_PERSONA_STORE_COL_IS_ONLINE, now_online,
-          EMPATHY_PERSONA_STORE_COL_CAN_AUDIO_CALL,
-              empathy_contact_get_capabilities (contact) &
-                EMPATHY_CAPABILITIES_AUDIO,
-          EMPATHY_PERSONA_STORE_COL_CAN_VIDEO_CALL,
-              empathy_contact_get_capabilities (contact) &
-                EMPATHY_CAPABILITIES_VIDEO,
-          -1);
-
-      g_object_unref (contact);
+      tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+      if (tp_contact != NULL)
+        {
+          contact = empathy_contact_dup_from_tp_contact (tp_contact);
+          store = folks_persona_get_store (persona);
+
+          pixbuf_avatar = empathy_pixbuf_avatar_from_contact_scaled (contact,
+              32, 32);
+          pixbuf_status = get_persona_status_icon (self, persona);
+
+          gtk_list_store_set (GTK_LIST_STORE (self), &iter,
+              EMPATHY_PERSONA_STORE_COL_ICON_STATUS, pixbuf_status,
+              EMPATHY_PERSONA_STORE_COL_PIXBUF_AVATAR, pixbuf_avatar,
+              EMPATHY_PERSONA_STORE_COL_PIXBUF_AVATAR_VISIBLE,
+                  priv->show_avatars,
+              EMPATHY_PERSONA_STORE_COL_NAME, alias,
+              EMPATHY_PERSONA_STORE_COL_ACCOUNT_NAME,
+                  folks_persona_store_get_display_name (store),
+              EMPATHY_PERSONA_STORE_COL_DISPLAY_ID,
+                  folks_persona_get_display_id (persona),
+              EMPATHY_PERSONA_STORE_COL_PRESENCE_TYPE,
+                  folks_presence_details_get_presence_type (
+                      FOLKS_PRESENCE_DETAILS (persona)),
+              EMPATHY_PERSONA_STORE_COL_STATUS,
+                  folks_presence_details_get_presence_message (
+                      FOLKS_PRESENCE_DETAILS (persona)),
+              EMPATHY_PERSONA_STORE_COL_IS_ONLINE, now_online,
+              EMPATHY_PERSONA_STORE_COL_CAN_AUDIO_CALL,
+                  empathy_contact_get_capabilities (contact) &
+                    EMPATHY_CAPABILITIES_AUDIO,
+              EMPATHY_PERSONA_STORE_COL_CAN_VIDEO_CALL,
+                  empathy_contact_get_capabilities (contact) &
+                    EMPATHY_CAPABILITIES_VIDEO,
+              -1);
+
+          g_object_unref (contact);
+        }
 
       if (pixbuf_avatar)
         g_object_unref (pixbuf_avatar);
@@ -566,6 +579,7 @@ sort_personas (FolksPersona *persona_a,
 {
   EmpathyContact *contact;
   TpAccount *account_a, *account_b;
+  TpContact *tp_contact_a, *tp_contact_b;
   gint ret_val;
 
   g_return_val_if_fail (persona_a != NULL || persona_b != NULL, 0);
@@ -585,13 +599,21 @@ sort_personas (FolksPersona *persona_a,
   if (ret_val != 0)
     goto out;
 
-  contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact (
-      TPF_PERSONA (persona_a)));
+  tp_contact_a = tpf_persona_get_contact (TPF_PERSONA (persona_a));
+  tp_contact_b = tpf_persona_get_contact (TPF_PERSONA (persona_b));
+
+  /* handle the case that one or more of these personas are from the cache */
+  if (tp_contact_a == NULL || tp_contact_b == NULL)
+    {
+      ret_val = (tp_contact_a != NULL ? 1 : -1);
+      goto out;
+    }
+
+  contact = empathy_contact_dup_from_tp_contact (tp_contact_a);
   account_a = empathy_contact_get_account (contact);
   g_object_unref (contact);
 
-  contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact (
-      TPF_PERSONA (persona_b)));
+  contact = empathy_contact_dup_from_tp_contact (tp_contact_b);
   account_b = empathy_contact_get_account (contact);
   g_object_unref (contact);
 
index 6d1629651f6e6cb5d0f49d89dc3f58670cee5c40..5cb77c94bfdf321beae92a157de5e06f747aa0d9 100644 (file)
@@ -174,6 +174,7 @@ query_tooltip_cb (EmpathyPersonaView *self,
 {
   EmpathyPersonaViewPriv *priv = GET_PRIV (self);
   FolksPersona *persona;
+  TpContact *tp_contact;
   EmpathyContact *contact;
   GtkTreeModel *model;
   GtkTreeIter iter;
@@ -201,8 +202,14 @@ query_tooltip_cb (EmpathyPersonaView *self,
   if (persona == NULL)
     goto OUT;
 
-  contact = empathy_contact_dup_from_tp_contact (tpf_persona_get_contact (
-      TPF_PERSONA (persona)));
+  tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+  if (tp_contact == NULL)
+    {
+      g_clear_object (&persona);
+      goto OUT;
+    }
+
+  contact = empathy_contact_dup_from_tp_contact (tp_contact);
 
   if (priv->tooltip_widget == NULL)
     {
index d5764894b35601c253330e9ee06deed56ad97eb4..eac5a8b84db3d1fa3e1d91ed2efad1396f173436 100644 (file)
@@ -2032,6 +2032,9 @@ empathy_contact_dup_best_for_action (FolksIndividual *individual,
         goto while_finish;
 
       tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
+      if (tp_contact == NULL)
+        goto while_finish;
+
       contact = empathy_contact_dup_from_tp_contact (tp_contact);
       empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
 
index f6aa49184c92b788b193375631102a1dc9f95257..47a01cb8d5b6df952e8a4bcca377aaf6337887da 100644 (file)
@@ -531,14 +531,21 @@ empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self,
 
       if (TPF_IS_PERSONA (persona))
         {
-          conn = tp_contact_get_connection (tpf_persona_get_contact (persona));
-          manager = empathy_contact_manager_dup_singleton ();
+          TpContact *tp_contact;
 
-          if (empathy_contact_manager_get_flags_for_connection (manager, conn) &
-              EMPATHY_CONTACT_LIST_CAN_BLOCK)
-            retval = TRUE;
+          tp_contact = tpf_persona_get_contact (persona);
+          if (tp_contact != NULL)
+            {
+              conn = tp_contact_get_connection (tp_contact);
+              manager = empathy_contact_manager_dup_singleton ();
 
-          g_object_unref (manager);
+              if (empathy_contact_manager_get_flags_for_connection (
+                    manager, conn) &
+                  EMPATHY_CONTACT_LIST_CAN_BLOCK)
+                retval = TRUE;
+
+              g_object_unref (manager);
+            }
         }
       g_clear_object (&persona);
     }
@@ -569,20 +576,25 @@ empathy_individual_manager_set_blocked (EmpathyIndividualManager *self,
 
       if (TPF_IS_PERSONA (persona))
         {
-          contact = empathy_contact_dup_from_tp_contact (
-              tpf_persona_get_contact (persona));
-          empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
-          manager = empathy_contact_manager_dup_singleton ();
-          flags = empathy_contact_manager_get_flags_for_connection (manager,
-              empathy_contact_get_connection (contact));
-
-          if (flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
-            empathy_contact_list_set_blocked (
-                EMPATHY_CONTACT_LIST (manager),
-                contact, blocked, abusive);
-
-          g_object_unref (manager);
-          g_object_unref (contact);
+          TpContact *tp_contact;
+
+          tp_contact = tpf_persona_get_contact (persona);
+          if (tp_contact != NULL)
+            {
+              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
+              manager = empathy_contact_manager_dup_singleton ();
+              flags = empathy_contact_manager_get_flags_for_connection (manager,
+                  empathy_contact_get_connection (contact));
+
+              if (flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
+                empathy_contact_list_set_blocked (
+                    EMPATHY_CONTACT_LIST (manager),
+                    contact, blocked, abusive);
+
+              g_object_unref (manager);
+              g_object_unref (contact);
+            }
         }
       g_clear_object (&persona);
     }
index 04a6c783668dd5e4772a44dbd4a9b073eb9bf3fa..9a0d167072c13faac40067eeee0e6ceb1991d552 100644 (file)
@@ -715,8 +715,11 @@ empathy_contact_dup_from_folks_individual (FolksIndividual *individual)
           TpContact *tp_contact;
 
           tp_contact = tpf_persona_get_contact (persona);
-          contact = empathy_contact_dup_from_tp_contact (tp_contact);
-          empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
+          if (tp_contact != NULL)
+            {
+              contact = empathy_contact_dup_from_tp_contact (tp_contact);
+              empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
+            }
         }
       g_clear_object (&persona);
     }