[gnome-commander] Only split the Samba user_name string if it is not null



commit 10ed6f2f5d172fd68dea645b0269ad4df9cfee09
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Mon Oct 4 15:08:13 2021 +0200

    Only split the Samba user_name string if it is not null

 src/dialogs/gnome-cmd-con-dialog.cc | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index 3de333f2..31c8c01e 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -587,17 +587,20 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
 
                 g_strfreev (a);
 
-                a = g_strsplit (user_name, ";", 2);
-
-                if (g_strv_length (a) > 1)
+                if (user_name)
                 {
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->domain_entry), a[0]);
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), a[1]);
+                    a = g_strsplit (user_name, ";", 2);
+                    if (g_strv_length (a) > 1)
+                    {
+                        gtk_entry_set_text (GTK_ENTRY (dialog->priv->domain_entry), a[0]);
+                        gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), a[1]);
+                    }
+                    else
+                    {
+                        gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), user_name);
+                    }
+                    g_strfreev (a);
                 }
-                else
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->user_entry), user_name);
-
-                g_strfreev (a);
             }
             else
             {


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