[gnome-commander] Only set the connection port if it can be parsed



commit 8c11e2bcfb9aec2cdab1b7168b376de42add55b1
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Mon Oct 4 15:09:07 2021 +0200

    Only set the connection port if it can be parsed

 src/dialogs/gnome-cmd-con-dialog.cc | 3 ++-
 src/gnome-cmd-con-remote.cc         | 3 ++-
 src/gnome-cmd-con.h                 | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index 31c8c01e..f969039e 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -664,7 +664,8 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
         gnome_cmd_con_set_user_name (con, user_name);
         gnome_cmd_con_set_host_name (con, host);
         gnome_cmd_con_set_root_path(con, path);
-        gnome_cmd_con_set_port(con, port);
+        if (port != -1)
+            gnome_cmd_con_set_port(con, port);
 
 
         con->method = (ConnectionMethodID) gtk_combo_box_get_active (GTK_COMBO_BOX 
(dialog->priv->type_combo));
diff --git a/src/gnome-cmd-con-remote.cc b/src/gnome-cmd-con-remote.cc
index 341047f2..cd8ea64f 100644
--- a/src/gnome-cmd-con-remote.cc
+++ b/src/gnome-cmd-con-remote.cc
@@ -297,7 +297,8 @@ GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const string &u
     gnome_cmd_con_set_uri (con, uri_str.c_str());
     gnome_cmd_con_set_user_name (con, user);
     gnome_cmd_con_set_host_name (con, host);
-    gnome_cmd_con_set_port (con, port);
+    if (port != -1)
+        gnome_cmd_con_set_port (con, port);
     gnome_cmd_con_set_root_path (con, path);
 
     gnome_cmd_con_remote_set_tooltips (server, host);
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 65b6de31..3e30b21c 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -90,7 +90,7 @@ struct GnomeCmdCon
 
     gchar               *username;
     gchar               *hostname;
-    guint16             port;
+    guint16             port{0};
     gchar               *open_msg;
     GnomeCmdPath        *base_path;
     GnomeVFSFileInfo    *base_info;


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