From e7666a8532a050b4ce02dc2140c1680f004dfc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Mon, 6 Oct 2014 13:43:45 +0200 Subject: [PATCH] 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. --- clients/tui/nmt-page-wifi.c | 14 ++++++++++---- 1 file 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);