]> git.0d.be Git - empathy.git/commitdiff
TpChat: don't crash with broken TpProperties implementations
authorWill Thompson <will.thompson@collabora.co.uk>
Tue, 6 Sep 2011 14:52:34 +0000 (15:52 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Tue, 6 Sep 2011 14:59:04 +0000 (15:59 +0100)
I forgot to take the Telepathy.Properties interface out of Gabble when I
removed Telepathy.Properties support from it. So Empathy called
ListProperties() on it anyway: fine, you might think, except the
callback set priv->had_properties_list to TRUE even if the method
returned an error. empathy_tp_chat_set_property() and
empathy_tp_chat_get_property() assume that if priv->had_properties_list is
TRUE, priv->properties is not NULL.

While I hope that we can delete this code entirely pretty soon, getting
this crash fix in seems like a good idea.

Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
libempathy/empathy-tp-chat.c

index 27003561e7f28dd151cdd5808e03aa7cf152a613..9eaff95924fa34b6397fde09298119958fe3a805 100644 (file)
@@ -686,13 +686,13 @@ tp_chat_list_properties_cb (TpProxy         *proxy,
        GArray            *ids;
        guint              i;
 
        GArray            *ids;
        guint              i;
 
-       self->priv->had_properties_list = TRUE;
-
        if (error) {
                DEBUG ("Error listing properties: %s", error->message);
                return;
        }
 
        if (error) {
                DEBUG ("Error listing properties: %s", error->message);
                return;
        }
 
+       self->priv->had_properties_list = TRUE;
+
        ids = g_array_sized_new (FALSE, FALSE, sizeof (guint), properties->len);
        self->priv->properties = g_ptr_array_sized_new (properties->len);
        for (i = 0; i < properties->len; i++) {
        ids = g_array_sized_new (FALSE, FALSE, sizeof (guint), properties->len);
        self->priv->properties = g_ptr_array_sized_new (properties->len);
        for (i = 0; i < properties->len; i++) {