[network-manager-applet] core: don't crash if we can't get active connection properties from NM (lp #430535)



commit b2579613718ce4f4f7c6521b00891b466105e3e5
Author: Dan Williams <dcbw redhat com>
Date:   Thu Oct 8 19:29:25 2009 -0700

    core: don't crash if we can't get active connection properties from NM (lp #430535)
    
    If the D-Bus call to get the 'connection' property of the active connection
    fails, the strcmp would segfault.

 src/applet.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 542145e..60ca0a2 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -237,9 +237,11 @@ applet_get_active_for_connection (NMApplet *applet, NMConnection *connection)
 	active_list = nm_client_get_active_connections (applet->nm_client);
 	for (i = 0; active_list && (i < active_list->len); i++) {
 		NMActiveConnection *active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_list, i));
+		const char *active_cpath = nm_active_connection_get_connection (active);
 
 		if (   (nm_active_connection_get_scope (active) == scope)
-		    && !strcmp (nm_active_connection_get_connection (active), cpath))
+		    && active_cpath
+		    && !strcmp (active_cpath, cpath))
 			return active;
 	}
 	return NULL;



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