[empathy] empathy_pixbuf_avatar_from_individual_scaled_async: set an error if no avatar



commit 4da0bbd6898436255b87ffb63fdcf775f56e5a2c
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Jan 16 15:12:56 2012 +0100

    empathy_pixbuf_avatar_from_individual_scaled_async: set an error if no avatar
    
    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 |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 4d61687..f3761e5 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]