aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-individual-widget.c
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2011-06-28 05:31:25 +0800
committerJonny Lamb <jonnylamb@gnome.org>2011-08-22 17:36:33 +0800
commitd1d3a49fc919ed734b77a6e94afb2d49109182f2 (patch)
tree8c329ef17d60f70dba7f6695378142e229ab44e2 /libempathy-gtk/empathy-individual-widget.c
parent358fab1eb85cecb34ca45f492be2e623ab443a5e (diff)
downloadgsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.tar
gsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.tar.gz
gsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.tar.bz2
gsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.tar.lz
gsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.tar.xz
gsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.tar.zst
gsoc2013-empathy-d1d3a49fc919ed734b77a6e94afb2d49109182f2.zip
Don't assume that all TpfPersonas contain valid TpContacts
Helps: bgo#653599 - Empathy shouldn't assume all TpfPersonas contain a valid TpContact Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
Diffstat (limited to 'libempathy-gtk/empathy-individual-widget.c')
-rw-r--r--libempathy-gtk/empathy-individual-widget.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c
index fcc076b9b..0a3844aa2 100644
--- a/libempathy-gtk/empathy-individual-widget.c
+++ b/libempathy-gtk/empathy-individual-widget.c
@@ -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);