[gnome-photos] facebook-item: Bail out as soon as there is an error



commit e363513cded63b04de6fed2b5c469db0ee139e76
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Apr 15 14:08:13 2014 +0200

    facebook-item: Bail out as soon as there is an error
    
    If we failed to refresh the authorization tokens, then we should
    immediately bail out instead of trying to retrieve the photo node from
    the Facebook graph. This is because of two reasons:
     - the failure could have been due to the GCancellable being cancelled,
       in which case we should stop as soon as possible, or
     - there was an actual failure and we should not trample over the
       GError that was set
    
    Fixes: https://bugzilla.gnome.org/727205

 src/photos-facebook-item.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-facebook-item.c b/src/photos-facebook-item.c
index 12c081b..4cc0f8b 100644
--- a/src/photos-facebook-item.c
+++ b/src/photos-facebook-item.c
@@ -57,17 +57,19 @@ photos_facebook_get_gfbgraph_photo (PhotosBaseItem *item, GCancellable *cancella
   PhotosSource *source;
   const gchar *identifier, *resource_urn;
   GFBGraphGoaAuthorizer *authorizer;
-  GFBGraphPhoto *photo;
+  GFBGraphPhoto *photo = NULL;
 
   resource_urn = photos_base_item_get_resource_urn (item);
   source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (priv->src_mngr, resource_urn));
   authorizer = gfbgraph_goa_authorizer_new (photos_source_get_goa_object (source));
   identifier = photos_base_item_get_identifier (item) + strlen("facebook:");
 
-  gfbgraph_authorizer_refresh_authorization (GFBGRAPH_AUTHORIZER (authorizer), cancellable, error);
+  if (!gfbgraph_authorizer_refresh_authorization (GFBGRAPH_AUTHORIZER (authorizer), cancellable, error))
+    goto out;
 
   photo = gfbgraph_photo_new_from_id (GFBGRAPH_AUTHORIZER (authorizer), identifier, error);
 
+ out:
   return photo;
 }
 


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