geoclue/libgeoclue-0.12.0-NMCrash.patch

32 lines
1006 B
Diff

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