[gnome-online-accounts/wip/rishi/libsecret-workaround: 5/7] daemon: Remove redundant NULL check and be more assertive



commit 6665677e9b4b1c80fb77d6d34b8a0d53295c3b8f
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jul 3 17:29:15 2017 +0200

    daemon: Remove redundant NULL check and be more assertive
    
    A GBusAcquiredCallback can never have a NULL GDBusConnection. This is a
    good opportunity to also sanity check the name.

 src/daemon/main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 1ce838e..9f9ac8f 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -45,8 +45,10 @@ on_bus_acquired (GDBusConnection *connection,
                  const gchar     *name,
                  gpointer         user_data)
 {
-  if (connection != NULL)
-    the_daemon = goa_daemon_new (connection);
+  g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
+  g_return_if_fail (name != NULL && name[0] != '\0');
+
+  the_daemon = goa_daemon_new (connection);
   g_debug ("Connected to the session bus");
 }
 


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