network: allow empty ip4 default gateway
authorAndreas Henriksson <andreas@fatal.se>
Wed, 12 Oct 2016 11:27:43 +0000 (13:27 +0200)
committerAndreas Henriksson <andreas@fatal.se>
Tue, 30 May 2017 20:29:04 +0000 (21:29 +0100)
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

index 502408a66d17221a13720e435e5cab2e949a13fa..94500292de6a4ff66225a67a2af00b325767e296 100644 (file)
@@ -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;
                          }