blob: b29c1b01126069602c47fa88b7bfb4b45bd14948 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
From patchwork Thu Feb 17 12:35:30 2011
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [sugar] Do not fail in NM-less environment
Date: Thu, 17 Feb 2011 17:35:30 -0000
From: Aleksey Lim <alsroot@activitycentral.org>
X-Patchwork-Id: 677
Message-Id: <1297946130-32247-1-git-send-email-alsroot@activitycentral.org>
To: dextrose@lists.sugarlabs.org
---
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:
|