[gnome-settings-daemon] sharing: Fix crash when run against older NM
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] sharing: Fix crash when run against older NM
- Date: Wed, 6 Aug 2014 09:23:20 +0000 (UTC)
commit d192314efbf4f0de0935ad2d656d7438b6872526
Author: Bastien Nocera <hadess hadess net>
Date: Wed Aug 6 11:18:52 2014 +0200
sharing: Fix crash when run against older NM
When run against an older version of NetworkManager,
nm_active_connection_get_connection_type() will return NULL as the
library supports the function, but the property doesn't exist in the
daemon.
Consider the sharing to be offline if the version of NetworkManager is
too old.
https://bugzilla.gnome.org/show_bug.cgi?id=732479
plugins/sharing/gsd-sharing-manager.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c
index dde28f5..c932908 100644
--- a/plugins/sharing/gsd-sharing-manager.c
+++ b/plugins/sharing/gsd-sharing-manager.c
@@ -596,6 +596,8 @@ primary_connection_changed (GObject *gobject,
manager->priv->current_network = g_strdup (nm_active_connection_get_uuid (a_con));
manager->priv->current_network_name = g_strdup (nm_active_connection_get_id (a_con));
manager->priv->carrier_type = g_strdup (nm_active_connection_get_connection_type (a_con));
+ if (manager->priv->carrier_type == NULL)
+ manager->priv->carrier_type = g_strdup ("");
} else {
manager->priv->current_network = g_strdup ("");
manager->priv->current_network_name = g_strdup ("");
@@ -604,6 +606,9 @@ primary_connection_changed (GObject *gobject,
if (!a_con) {
manager->priv->sharing_status = GSD_SHARING_STATUS_OFFLINE;
+ } else if (*(manager->priv->carrier_type) == '\0') {
+ /* Missing carrier type information? */
+ manager->priv->sharing_status = GSD_SHARING_STATUS_OFFLINE;
} else if (g_str_equal (manager->priv->carrier_type, "bluetooth") ||
g_str_equal (manager->priv->carrier_type, "gsm") ||
g_str_equal (manager->priv->carrier_type, "cdma")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]