[network-manager-fortisslvpn/nm-1-0: 6/13] service: more robust error handling



commit 9413de85c5880fa36186b4ae454225e8d27526d1
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Sep 28 11:26:14 2015 +0200

    service: more robust error handling
    
    (cherry picked from commit b121816ec2dd93d6ea20ba2173522a2867d44d28)

 src/nm-fortisslvpn-service.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/nm-fortisslvpn-service.c b/src/nm-fortisslvpn-service.c
index b040611..31e62cd 100644
--- a/src/nm-fortisslvpn-service.c
+++ b/src/nm-fortisslvpn-service.c
@@ -180,7 +180,8 @@ nm_fortisslvpn_ppp_service_new (NMConnection *connection, GError **error)
                                           "org.freedesktop.DBus",
                                           "/org/freedesktop/DBus",
                                           "org.freedesktop.DBus");
-       g_assert (proxy);
+       if (!proxy)
+               goto out;
        success = dbus_g_proxy_call (proxy, "RequestName", error,
                                     G_TYPE_STRING, NM_DBUS_SERVICE_FORTISSLVPN_PPP,
                                     G_TYPE_UINT, 0,
@@ -198,8 +199,7 @@ nm_fortisslvpn_ppp_service_new (NMConnection *connection, GError **error)
         * plugin when it asks for them.
         */
        if (!_service_cache_credentials (self, connection, error)) {
-               g_object_unref (self);
-               self = NULL;
+               g_clear_object (&self);
                goto out;
        }
 
@@ -801,6 +801,8 @@ real_connect (NMVPNPlugin *plugin, NMConnection *connection, GError **error)
        mode_t old_umask;
        gchar *config;
 
+       g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
        s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
        g_assert (s_vpn);
 


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