]> git.0d.be Git - empathy.git/commitdiff
empathy_pixbuf_avatar_from_individual_scaled_async: set an error if no avatar
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 16 Jan 2012 14:12:56 +0000 (15:12 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 17 Jan 2012 08:25:53 +0000 (09:25 +0100)
It's fair for the caller to expect the error the be set if the _finish()
function returns NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=667037

libempathy-gtk/empathy-ui-utils.c

index 4d61687458e6e1ebe1ef9380d12c3bc9f7357317..f3761e5cdf989db13cc4ace95b5760779c5151a5 100644 (file)
@@ -718,26 +718,25 @@ empathy_pixbuf_avatar_from_individual_scaled_async (
 
        avatar_icon =
                folks_avatar_details_get_avatar (FOLKS_AVATAR_DETAILS (individual));
-       if (avatar_icon == NULL)
-               goto out;
+       if (avatar_icon == NULL) {
+               g_simple_async_result_set_error (result, TP_ERRORS,
+                       TP_ERROR_INVALID_ARGUMENT, "no avatar found");
+
+               g_simple_async_result_complete (result);
+               g_object_unref (result);
+               return;
+       }
 
        closure = pixbuf_avatar_from_individual_closure_new (individual, result,
                                                             width, height,
                                                             cancellable);
-       if (closure == NULL)
-               goto out;
+
+       g_return_if_fail (closure != NULL);
 
        g_loadable_icon_load_async (avatar_icon, width, cancellable,
                        avatar_icon_load_cb, closure);
 
        g_object_unref (result);
-
-       return;
-
-out:
-       g_simple_async_result_set_op_res_gpointer (result, NULL, NULL);
-       g_simple_async_result_complete (result);
-       g_object_unref (result);
 }
 
 /* Return a ref on the GdkPixbuf */