[network-manager-applet] applet: don't crash if we can't get some ActiveConnection attributes (rh #545011)



commit 5bd5f143003aa3d3cdc1bb0ca218746f6cf7d328
Author: Dan Williams <dcbw redhat com>
Date:   Mon Dec 7 10:40:07 2009 -0800

    applet: don't crash if we can't get some ActiveConnection attributes (rh #545011)
    
    It'll still fail, but we shouldn't just crash.

 src/applet.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 3279e1a..6ad6a8f 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2458,10 +2458,21 @@ find_active_device (NMAGConfConnection *connection,
 
 		active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_connections, i));
 		service_name = nm_active_connection_get_service_name (active);
+		if (!service_name) {
+			/* Shouldn't happen; but we shouldn't crash either */
+			g_warning ("%s: couldn't get service name for active connection!", __func__);
+			continue;
+		}
+
 		if (strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS))
 			continue;
 
 		connection_path = nm_active_connection_get_connection (active);
+		if (!connection_path) {
+			/* Shouldn't happen; but we shouldn't crash either */
+			g_warning ("%s: couldn't get connection path for active connection!", __func__);
+			continue;
+		}
 
 		if (!strcmp (connection_path, nm_connection_get_path (NM_CONNECTION (connection)))) {
 			devices = nm_active_connection_get_devices (active);



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