summaryrefslogtreecommitdiffstats
path: root/geoclue/geoclue-NMCrash.patch
blob: d2afc879e59d725413621ae2089b3114aa506031 (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
From bcf9ee4f44625eddad4c267fedc507d9eeeaf3f4 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 29 Jun 2010 18:47:21 +0000
Subject: Fix crasher when NetworkManager has no devices

https://bugs.freedesktop.org/show_bug.cgi?id=28066
---
diff --git a/src/connectivity-networkmanager.c b/src/connectivity-networkmanager.c
index 1061201..a7b8971 100644
--- a/src/connectivity-networkmanager.c
+++ b/src/connectivity-networkmanager.c
@@ -248,16 +248,12 @@ cache_ap_mac (GeoclueNetworkManager *self)
 	guint i;
 
 	devices = nm_client_get_devices (self->client);
-	if (devices == NULL) {
-		g_free (self->cache_ap_mac);
-		self->cache_ap_mac = NULL;
-	}
 
 	g_free (self->cache_ap_mac);
 	self->cache_ap_mac = NULL;
 	self->ap_strength = 0;
 
-	for (i = 0; i < devices->len; i++) {
+	for (i = 0; devices != NULL && i < devices->len; i++) {
 		NMDevice *device = g_ptr_array_index (devices, i);
 		if (NM_IS_DEVICE_WIFI (device)) {
 			get_best_ap (self, device);
--
cgit v0.8.3-6-g21f6