]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-contact.c
Make sure to not ref a NULL object
[empathy.git] / libempathy / empathy-contact.c
index 46d80d3be6e51854ee5a006b511f7573caa72ede..d248b2dd7b71d7c46cd7293142274ee391c7094f 100644 (file)
@@ -147,15 +147,15 @@ empathy_contact_class_init (EmpathyContactClass *class)
         "TpContact",
         "The TpContact associated with the contact",
         TP_TYPE_CONTACT,
-        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE));
+        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
-      PROP_TP_CONTACT,
+      PROP_ACCOUNT,
       g_param_spec_object ("account",
         "The account",
         "The account associated with the contact",
         MC_TYPE_ACCOUNT,
-        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READABLE));
+        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
       PROP_ID,
@@ -274,6 +274,9 @@ set_tp_contact (EmpathyContact *contact,
 {
   EmpathyContactPriv *priv = GET_PRIV (contact);
 
+  if (tp_contact == NULL)
+    return;
+
   g_assert (priv->tp_contact == NULL);
   priv->tp_contact = g_object_ref (tp_contact);
   priv->presence = empathy_contact_get_presence (contact);
@@ -379,6 +382,8 @@ contact_set_property (GObject *object,
 EmpathyContact *
 empathy_contact_new (TpContact *tp_contact)
 {
+  g_return_val_if_fail (TP_IS_CONTACT (tp_contact), NULL);
+
   return g_object_new (EMPATHY_TYPE_CONTACT,
       "tp-contact", tp_contact,
       NULL);