[network-manager-applet] applet: add some assertions to get_icon() functions



commit 0741ae373562aed267553ce6a598ee941c39a262
Author: Thomas Haller <thaller redhat com>
Date:   Mon Mar 7 15:30:48 2016 +0100

    applet: add some assertions to get_icon() functions

 src/applet-device-broadband.c |    3 +++
 src/applet-device-bt.c        |    3 +++
 src/applet-device-ethernet.c  |    3 +++
 src/applet-device-wifi.c      |    3 +++
 src/mobile-helpers.c          |    5 ++++-
 5 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index e2a809d..64c57c9 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -629,6 +629,9 @@ get_icon (NMDevice *device,
 {
        BroadbandDeviceInfo *info;
 
+       g_return_if_fail (out_icon_name && !*out_icon_name);
+       g_return_if_fail (tip && !*tip);
+
        if (!applet->mm1) {
                g_warning ("ModemManager is not available for modem at %s", nm_device_get_udi (device));
                return;
diff --git a/src/applet-device-bt.c b/src/applet-device-bt.c
index e53e096..455eea6 100644
--- a/src/applet-device-bt.c
+++ b/src/applet-device-bt.c
@@ -102,6 +102,9 @@ bt_get_icon (NMDevice *device,
        NMSettingConnection *s_con;
        const char *id;
 
+       g_return_if_fail (out_icon_name && !*out_icon_name);
+       g_return_if_fail (tip && !*tip);
+
        id = nm_device_get_iface (NM_DEVICE (device));
        if (connection) {
                s_con = nm_connection_get_setting_connection (connection);
diff --git a/src/applet-device-ethernet.c b/src/applet-device-ethernet.c
index 7b19a1d..174b790 100644
--- a/src/applet-device-ethernet.c
+++ b/src/applet-device-ethernet.c
@@ -147,6 +147,9 @@ ethernet_get_icon (NMDevice *device,
        NMSettingConnection *s_con;
        const char *id;
 
+       g_return_if_fail (out_icon_name && !*out_icon_name);
+       g_return_if_fail (tip && !*tip);
+
        id = nm_device_get_iface (NM_DEVICE (device));
        if (connection) {
                s_con = nm_connection_get_setting_connection (connection);
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index b768fb0..d248566 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1258,6 +1258,9 @@ wifi_get_icon (NMDevice *device,
        const char *id;
        guint8 strength;
 
+       g_return_if_fail (out_icon_name && !*out_icon_name);
+       g_return_if_fail (tip && !*tip);
+
        ap = g_object_get_data (G_OBJECT (device), ACTIVE_AP_TAG);
 
        id = nm_device_get_iface (device);
diff --git a/src/mobile-helpers.c b/src/mobile-helpers.c
index 7a6b61d..efd954e 100644
--- a/src/mobile-helpers.c
+++ b/src/mobile-helpers.c
@@ -110,7 +110,7 @@ mobile_helper_get_quality_icon_name (guint32 quality)
                return "nm-signal-50";
        else if (quality > 5)
                return "nm-signal-25";
-       else 
+       else
                return "nm-signal-00";
 }
 
@@ -580,6 +580,9 @@ mobile_helper_get_icon (NMDevice *device,
        NMSettingConnection *s_con;
        const char *id;
 
+       g_return_if_fail (out_icon_name && !*out_icon_name);
+       g_return_if_fail (tip && !*tip);
+
        id = nm_device_get_iface (NM_DEVICE (device));
        if (connection) {
                s_con = nm_connection_get_setting_connection (connection);


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