[network-manager-applet] applet: do not crash when ModemManager is not available (rh #1199288)



commit 98dc7a7657b2609fcac05134db99455a9de6610a
Author: Jiří Klimeš <jklimes redhat com>
Date:   Thu Apr 2 14:06:39 2015 +0200

    applet: do not crash when ModemManager is not available (rh #1199288)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1199288

 src/applet-device-broadband.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 1bf750e..bb9e966 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -476,7 +476,15 @@ get_secrets (SecretsRequest *req,
                return FALSE;
 
        devinfo = g_object_get_data (G_OBJECT (device), "devinfo");
-       g_assert (devinfo);
+       if (!devinfo) {
+               g_set_error (error,
+                            NM_SECRET_AGENT_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
+                            "%s.%d (%s): ModemManager is not available for modem at %s",
+                            __FILE__, __LINE__, __func__,
+                            nm_device_get_udi (device));
+               return FALSE;
+       }
 
        /* A GetSecrets PIN dialog overrides the initial unlock dialog */
        if (devinfo->dialog)
@@ -716,6 +724,11 @@ add_menu_item (NMDevice *device,
        int i;
 
        info = g_object_get_data (G_OBJECT (device), "devinfo");
+       if (!info) {
+               g_warning ("ModemManager is not available for modem at %s",
+                          nm_device_get_udi (device));
+               return;
+       }
 
        if (multiple_devices) {
                const char *desc;


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