[gnome-control-center] network: fix warnings when virtual connections exist



commit e3c9f53a09171181f651142b880843eb6ad0897a
Author: Dan Winship <danw gnome org>
Date:   Mon Feb 4 16:53:00 2013 -0500

    network: fix warnings when virtual connections exist
    
    Fix the call to nma_utils_disambiguate_device_names() to filter out
    any NULL NMDevices, to avoid warnings.

 panels/network/cc-network-panel.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 06f2232..e40e9fa 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -489,7 +489,7 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
 #ifdef HAVE_NM_UNSTABLE
         GPtrArray *ndarray, *nmdarray;
         NetDevice **devices;
-        NMDevice **nm_devices;
+        NMDevice **nm_devices, *nm_device;
         gchar **titles;
         gint i, num_devices;
 
@@ -500,8 +500,13 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
         }
 
         nmdarray = g_ptr_array_new ();
-        for (i = 0; i < ndarray->len; i++)
-                g_ptr_array_add (nmdarray, net_device_get_nm_device (ndarray->pdata[i]));
+        for (i = 0; i < ndarray->len; i++) {
+                nm_device = net_device_get_nm_device (ndarray->pdata[i]);
+                if (nm_device)
+                        g_ptr_array_add (nmdarray, nm_device);
+                else
+                        g_ptr_array_remove_index (ndarray, i--);
+        }
 
         devices = (NetDevice **)ndarray->pdata;
         nm_devices = (NMDevice **)nmdarray->pdata;


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