[gnome-control-center] network: allow empty ip4 default gateway



commit 898d0aa4e9780078ff3f978a2e439e4a2b85e682
Author: Andreas Henriksson <andreas fatal se>
Date:   Wed Oct 12 13:27:43 2016 +0200

    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

 panels/network/connection-editor/ce-page-ip4.c |    5 +++--
 1 files 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;
                          }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]