[PATCH 1/2] Don't rely on having some network devices available

Vratislav Podzimek vpodzime at redhat.com
Thu Aug 16 11:51:03 UTC 2012


If there are no network devices available, itr returned from the
devices_store.get_iter_first() is None and unchecked use raises an
exception. This can happen e.g. when running 'make runhub' on a
system with NetworkManager.service not running.
---
 pyanaconda/ui/gui/spokes/network.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 9142ad0..ed330f3 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -337,7 +337,9 @@ class NetworkControlBox():
         treeview = self.builder.get_object("treeview_devices")
         devices_store = self.builder.get_object("liststore_devices")
         selection = treeview.get_selection()
-        selection.select_iter(devices_store.get_iter_first())
+        itr = devices_store.get_iter_first()
+        if itr:
+            selection.select_iter(itr)
 
     def refresh(self):
         device = self.selected_device()
-- 
1.7.11.2



More information about the anaconda-patches mailing list