diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-09-19 10:24:38 +0200 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-09-19 09:07:16 -0400 |
commit | 4359e556e41febb2dcf9e86ad72bcdef42fa879e (patch) | |
tree | d0215c4f38b9608db8a717ec2ccda9fa7a466db3 | |
parent | 8f6d056b3157fb6131c7d3a6a13c224d9b6bc279 (diff) | |
download | NetworkManager-4359e556e41febb2dcf9e86ad72bcdef42fa879e.tar.gz |
tui,examples: accept null SSID gracefully
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
https://bugzilla.gnome.org/show_bug.cgi?id=736802
-rw-r--r-- | clients/tui/nmt-connect-connection-list.c | 7 | ||||
-rw-r--r-- | examples/C/glib/get-ap-info-libnm.c | 12 |
2 files changed, 13 insertions, 6 deletions
diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c index f3b02e99a7..98e46ba14f 100644 --- a/clients/tui/nmt-connect-connection-list.c +++ b/clients/tui/nmt-connect-connection-list.c @@ -294,8 +294,9 @@ add_connections_for_aps (NmtConnectDevice *nmtdev, nmtconn->device = nmtdev->device; nmtconn->ap = g_object_ref (ap); ssid = nm_access_point_get_ssid (ap); - nmtconn->ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), - g_bytes_get_size (ssid)); + if (ssid) + nmtconn->ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), + g_bytes_get_size (ssid)); for (iter = connections; iter; iter = iter->next) { conn = iter->data; @@ -308,7 +309,7 @@ add_connections_for_aps (NmtConnectDevice *nmtdev, } if (!iter) - nmtconn->name = nmtconn->ssid; + nmtconn->name = nmtconn->ssid ? nmtconn->ssid : "<unknown>"; nmtdev->conns = g_slist_prepend (nmtdev->conns, nmtconn); } diff --git a/examples/C/glib/get-ap-info-libnm.c b/examples/C/glib/get-ap-info-libnm.c index efb70bf4b8..5868c27904 100644 --- a/examples/C/glib/get-ap-info-libnm.c +++ b/examples/C/glib/get-ap-info-libnm.c @@ -97,7 +97,10 @@ show_access_point_info (NMAccessPoint *ap) strength = nm_access_point_get_strength (ap); /* Convert to strings */ - ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); + if (ssid) + ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); + else + ssid_str = g_strdup ("--"); freq_str = g_strdup_printf ("%u MHz", freq); bitrate_str = g_strdup_printf ("%u Mbit/s", bitrate/1000); strength_str = g_strdup_printf ("%u", strength); @@ -163,8 +166,11 @@ show_wifi_device_info (NMDevice *device) if (nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) { if ((active_ap = nm_device_wifi_get_active_access_point (NM_DEVICE_WIFI (device)))) { active_ssid = nm_access_point_get_ssid (active_ap); - active_ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (active_ssid, NULL), - g_bytes_get_size (active_ssid)); + if (active_ssid) + active_ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (active_ssid, NULL), + g_bytes_get_size (active_ssid)); + else + active_ssid_str = g_strdup ("--"); } } |