diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-10 19:02:30 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-11 13:46:17 +0100 |
commit | 203515cea77126c5a1b7d6d8cfc2ae372d34ab08 (patch) | |
tree | 36cd3076f9af787ef8d5598817f1d656a22b77ca /telepathy-glib/connection-contact-list.c | |
parent | 792f37a447e49accfef9c66d8e5e655cdaea234f (diff) | |
download | telepathy-glib-203515cea77126c5a1b7d6d8cfc2ae372d34ab08.tar.gz |
connection-contact-list: don't crash if no Contacts
This situation would be stupid, but we still shouldn't crash.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49735
Diffstat (limited to 'telepathy-glib/connection-contact-list.c')
-rw-r--r-- | telepathy-glib/connection-contact-list.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/telepathy-glib/connection-contact-list.c b/telepathy-glib/connection-contact-list.c index a0650a213..2e6d597bd 100644 --- a/telepathy-glib/connection-contact-list.c +++ b/telepathy-glib/connection-contact-list.c @@ -231,6 +231,7 @@ got_contact_list_attributes_cb (TpConnection *self, GObject *weak_object) { GSimpleAsyncResult *result = (GSimpleAsyncResult *) weak_object; + /* may be NULL if error != NULL, when calling directly */ GArray *features = user_data; GHashTableIter iter; gpointer key, value; @@ -305,6 +306,19 @@ prepare_roster (TpConnection *self, DEBUG ("CM has the roster for connection %s, fetch it now.", tp_proxy_get_object_path (self)); + /* Pre-empt _tp_contacts_bind_to_signals, which assumes that Contacts + * is present and works correctly */ + if (!tp_proxy_has_interface_by_id (self, + TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACTS)) + { + GError error = { TP_DBUS_ERRORS, TP_DBUS_ERROR_NO_INTERFACE, + "Obsolete CM does not have the Contacts interface" }; + + got_contact_list_attributes_cb (self, NULL, &error, NULL, + (GObject *) result); + return; + } + tp_cli_connection_interface_contact_list_connect_to_contacts_changed_with_id ( self, contacts_changed_cb, NULL, NULL, NULL, NULL); |