aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-11 23:58:37 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-12 01:16:43 +0800
commit4950a9c2e79b6c92510c738283a2b40c936570d6 (patch)
tree0a0d7f2017f4766832441a5c7d92261f4abfe7ec
parent3a1d17fbbf289577c8849d6c087f864907e99a1a (diff)
downloadgsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.tar
gsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.tar.gz
gsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.tar.bz2
gsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.tar.lz
gsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.tar.xz
gsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.tar.zst
gsoc2013-empathy-4950a9c2e79b6c92510c738283a2b40c936570d6.zip
empathy-tp-contact-factory: ensure that empathy_tp_contact_factory_get_from_handle always return an error if the contact hasn't been created
-rw-r--r--libempathy/empathy-tp-contact-factory.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index 2acbdd991..d326626a1 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -1069,18 +1069,35 @@ get_contact_by_handle_cb (TpConnection *connection,
{
GetContactsData *data = user_data;
EmpathyContact *contact = NULL;
+ GError *err = NULL;
if (n_contacts == 1) {
contact = dup_contact_for_tp_contact (data->tp_factory,
contacts[0]);
}
+ else {
+ if (error == NULL) {
+ /* tp-glib will provide an error only if the whole operation failed,
+ * but not if, for example, the handle was invalid. We create an error
+ * so the caller of empathy_tp_contact_factory_get_from_handle can
+ * rely on the error to check if the operation succeeded or not. */
+
+ err = g_error_new_literal (TP_ERRORS, TP_ERROR_INVALID_HANDLE,
+ "handle is invalid");
+ }
+ else {
+ err = g_error_copy (error);
+ }
+ }
if (data->callback.contact_cb) {
data->callback.contact_cb (data->tp_factory,
contact,
- error,
+ err,
data->user_data, weak_object);
}
+
+ g_clear_error (&err);
}
void