* 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);
/* 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);
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);
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);
}
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);