diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-10-06 13:43:45 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-10-06 13:52:43 +0200 |
commit | e7666a8532a050b4ce02dc2140c1680f004dfc27 (patch) | |
tree | c0d22d3fb79082bd7c849b81cb41cbc4b42700ff | |
parent | 33e50e817bc8cf842509e2d1bbd480c5a9638d38 (diff) | |
download | NetworkManager-e7666a8532a050b4ce02dc2140c1680f004dfc27.tar.gz |
tui: fix accessing NULL in g_bytes_get_data()
GLib-CRITICAL **: g_bytes_get_size: assertion 'bytes != NULL' failed
GLib-CRITICAL **: g_bytes_get_data: assertion 'bytes != NULL' failed
libnm-CRITICAL **: nm_utils_ssid_to_utf8: assertion 'ssid != NULL' failed
GLib-CRITICAL **: g_bytes_get_size: assertion 'bytes != NULL' failed
GLib-CRITICAL **: g_bytes_get_data: assertion 'bytes != NULL' failed
libnm-CRITICAL **: nm_utils_ssid_to_utf8: assertion 'ssid != NULL' failed
Additional fixes to commit 4359e556e41febb2dcf9e86ad72bcdef42fa879e.
-rw-r--r-- | clients/tui/nmt-page-wifi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/clients/tui/nmt-page-wifi.c b/clients/tui/nmt-page-wifi.c index 0d2693983a..21e75a4ddd 100644 --- a/clients/tui/nmt-page-wifi.c +++ b/clients/tui/nmt-page-wifi.c @@ -138,8 +138,11 @@ ssid_transform_to_entry (GBinding *binding, char *utf8; ssid = g_value_get_boxed (source_value); - utf8 = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), - g_bytes_get_size (ssid)); + if (ssid) + utf8 = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), + g_bytes_get_size (ssid)); + else + utf8 = g_strdup (""); g_value_take_string (target_value, utf8); return TRUE; } @@ -158,8 +161,11 @@ ssid_transform_from_entry (GBinding *binding, text = g_value_get_string (source_value); old_ssid = nm_setting_wireless_get_ssid (s_wireless); - utf8 = nm_utils_ssid_to_utf8 (g_bytes_get_data (old_ssid, NULL), - g_bytes_get_size (old_ssid)); + if (old_ssid) + utf8 = nm_utils_ssid_to_utf8 (g_bytes_get_data (old_ssid, NULL), + g_bytes_get_size (old_ssid)); + else + utf8 = g_strdup (""); if (!g_strcmp0 (text, utf8)) { g_free (utf8); |