summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-09-17 09:36:23 -0400
committerDan Winship <danw@gnome.org>2014-09-19 09:06:20 -0400
commit8f6d056b3157fb6131c7d3a6a13c224d9b6bc279 (patch)
tree6641c55c7bbbe337419945cf3e4de2edcec30b22
parentb769c059f33d765cf2760a35b2789c93b6a76270 (diff)
downloadNetworkManager-8f6d056b3157fb6131c7d3a6a13c224d9b6bc279.tar.gz
libnm: fix nm_access_point_get_ssid() return value
nm_access_point_get_ssid() used to return NULL if the AP didn't have a visible SSID. This got broken in the NM_TYPE_SSID -> G_TYPE_BYTES change. Fix that. (Fixes a crash in nmtui and nmcli with SSID-less APs.) https://bugzilla.gnome.org/show_bug.cgi?id=736802
-rw-r--r--libnm/nm-access-point.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libnm/nm-access-point.c b/libnm/nm-access-point.c
index fc36c0faa8..bca5220a50 100644
--- a/libnm/nm-access-point.c
+++ b/libnm/nm-access-point.c
@@ -121,14 +121,20 @@ nm_access_point_get_rsn_flags (NMAccessPoint *ap)
*
* Gets the SSID of the access point.
*
- * Returns: the #GBytes containing the SSID.
+ * Returns: the #GBytes containing the SSID, or %NULL if the SSID is unknown.
**/
GBytes *
nm_access_point_get_ssid (NMAccessPoint *ap)
{
+ NMAccessPointPrivate *priv;
+
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
- return NM_ACCESS_POINT_GET_PRIVATE (ap)->ssid;
+ priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
+ if (!priv->ssid || g_bytes_get_size (priv->ssid) == 0)
+ return NULL;
+
+ return priv->ssid;
}
/**
@@ -502,7 +508,7 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
/**
* NMAccessPoint:ssid:
*
- * The SSID of the access point.
+ * The SSID of the access point, or %NULL if it is not known.
**/
g_object_class_install_property
(object_class, PROP_SSID,