[empathy] Don't assume that all FolksIndividuals have a corresponding EmpathyContact.
- From: Jonny Lamb <jonnylamb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Don't assume that all FolksIndividuals have a corresponding EmpathyContact.
- Date: Mon, 22 Aug 2011 09:37:17 +0000 (UTC)
commit 2e4efa578faaebb0ef45606080d3586e8e2e739f
Author: Travis Reitter <travis reitter collabora co uk>
Date: Mon Jun 27 21:29:31 2011 -0700
Don't assume that all FolksIndividuals have a corresponding EmpathyContact.
Closes: bgo#653599 - Empathy shouldn't assume all TpfPersonas contain a
valid TpContact
Signed-off-by: Jonny Lamb <jonnylamb gnome org>
libempathy-gtk/empathy-individual-store.c | 39 +++++++++++++++++------------
libempathy-gtk/empathy-individual-view.c | 3 +-
2 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 4bdded8..83ee67e 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -1431,25 +1431,28 @@ individual_store_contact_sort (FolksIndividual *individual_a,
contact_a = empathy_contact_dup_from_folks_individual (individual_a);
contact_b = empathy_contact_dup_from_folks_individual (individual_b);
- account_a = empathy_contact_get_account (contact_a);
- account_b = empathy_contact_get_account (contact_b);
+ if (contact_a != NULL && contact_b != NULL)
+ {
+ account_a = empathy_contact_get_account (contact_a);
+ account_b = empathy_contact_get_account (contact_b);
- g_assert (account_a != NULL);
- g_assert (account_b != NULL);
+ g_assert (account_a != NULL);
+ g_assert (account_b != NULL);
- /* protocol */
- ret_val = g_strcmp0 (tp_account_get_protocol (account_a),
- tp_account_get_protocol (account_b));
+ /* protocol */
+ ret_val = g_strcmp0 (tp_account_get_protocol (account_a),
+ tp_account_get_protocol (account_b));
- if (ret_val != 0)
- goto out;
+ if (ret_val != 0)
+ goto out;
- /* account ID */
- ret_val = g_strcmp0 (tp_proxy_get_object_path (account_a),
- tp_proxy_get_object_path (account_b));
+ /* account ID */
+ ret_val = g_strcmp0 (tp_proxy_get_object_path (account_a),
+ tp_proxy_get_object_path (account_b));
- if (ret_val != 0)
- goto out;
+ if (ret_val != 0)
+ goto out;
+ }
/* identifier */
ret_val = g_utf8_collate (folks_individual_get_id (individual_a),
@@ -2003,8 +2006,12 @@ individual_store_get_individual_status_icon_with_icon_name (
if (show_protocols_here)
{
contact = empathy_contact_dup_from_folks_individual (individual);
- protocol_name = empathy_protocol_name_for_contact (contact);
- icon_name = g_strdup_printf ("%s-%s", status_icon_name, protocol_name);
+ if (contact != NULL)
+ {
+ protocol_name = empathy_protocol_name_for_contact (contact);
+ icon_name = g_strdup_printf ("%s-%s", status_icon_name,
+ protocol_name);
+ }
}
else
{
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index db63f0c..9d23027 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -692,7 +692,8 @@ individual_view_drag_motion (GtkWidget *widget,
EmpathyContact *contact = NULL;
contact = empathy_contact_dup_from_folks_individual (individual);
- caps = empathy_contact_get_capabilities (contact);
+ if (contact != NULL)
+ caps = empathy_contact_get_capabilities (contact);
tp_clear_object (&contact);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]