From 92a8a301ded7a8dfbf5e30282cb731f8ff2f621f Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Wed, 12 Oct 2016 13:27:43 +0200 Subject: [PATCH] network: allow empty ip4 default gateway Null-checking the text_gateway makes no sense as it has already been dereferenced earlier. Instead check if it's the empty string and treat that as not-an-error. Also prevent the empty string from being set in default_gateway. https://bugzilla.gnome.org/show_bug.cgi?id=708500 Gbp-Pq: Name git_allow_empty_ip4_gateway.patch --- panels/network/connection-editor/ce-page-ip4.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c index 502408a..9450029 100644 --- a/panels/network/connection-editor/ce-page-ip4.c +++ b/panels/network/connection-editor/ce-page-ip4.c @@ -765,12 +765,13 @@ ui_to_setting (CEPageIP4 *page) } if (gtk_widget_is_visible (GTK_WIDGET (gateway_entry)) && - text_gateway && !nm_utils_ipaddr_valid (AF_INET, text_gateway)) { + *text_gateway && + !nm_utils_ipaddr_valid (AF_INET, text_gateway)) { widget_set_error (g_object_get_data (G_OBJECT (row), "gateway")); ret = FALSE; } else { widget_unset_error (GTK_WIDGET (gateway_entry)); - if (gtk_widget_is_visible (GTK_WIDGET (gateway_entry))) { + if (gtk_widget_is_visible (GTK_WIDGET (gateway_entry)) && *text_gateway) { g_assert (default_gateway == NULL); default_gateway = text_gateway; } -- 2.30.2