[gnome-online-accounts: 2/2] examples: Silence -Wmaybe-uninitialized



commit f6e8d84cd1f2780220c64f5e0ae245090e02c8d7
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Nov 23 20:24:22 2018 +0100

    examples: Silence -Wmaybe-uninitialized

 src/examples/lastfm-shout.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/examples/lastfm-shout.c b/src/examples/lastfm-shout.c
index 92923041..7b50743a 100644
--- a/src/examples/lastfm-shout.c
+++ b/src/examples/lastfm-shout.c
@@ -31,7 +31,7 @@ main (int argc, char **argv)
   GError *error = NULL;
   GoaClient *client;
   GList *accounts, *l;
-  GoaAccount *account;
+  GoaAccount *account = NULL;
   GoaOAuth2Based *oauth2 = NULL;
   char *access_token = NULL;
   RestProxy *proxy;
@@ -67,8 +67,10 @@ main (int argc, char **argv)
 
   g_list_free_full (accounts, (GDestroyNotify) g_object_unref);
 
-  g_assert (account);
-  g_assert (oauth2);
+  if (account == NULL || oauth2 == NULL) {
+    g_print ("Last.fm account not found\n");
+    return 1;
+  }
 
   if (!goa_oauth2_based_call_get_access_token_sync (oauth2, &access_token, NULL, NULL, &error)) {
     g_error ("Could not get access token %s\n", error->message);


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