[Dextrose] [PATCH sugar] Do not fail in NM-less environment

Aleksey Lim alsroot at activitycentral.org
Thu Feb 17 07:35:30 EST 2011


---
 src/jarabe/model/network.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index dd9a061..efc3c90 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -784,6 +784,9 @@ def get_settings():
     return _nm_settings
 
 def find_connection_by_ssid(ssid):
+    if get_settings() is None:
+        return None
+
     connections = get_settings().connections
 
     for conn_index in connections:
@@ -918,6 +921,9 @@ def load_connections():
     load_gsm_connection()
 
 def find_gsm_connection():
+    if get_settings() is None:
+        return None
+
     connections = get_settings().connections
 
     for connection in connections.values():
@@ -928,7 +934,10 @@ def find_gsm_connection():
     return None
 
 def count_wifi_connections():
-    return len(get_settings().connections)
+    if get_settings() is None:
+        return 0
+    else:
+        return len(get_settings().connections)
 
 def clear_wifi_connections():
     if _nm_settings is not None:
-- 
1.7.3.4



More information about the Dextrose mailing list