[nautilus] Fix crash in connect server dialog



commit f8f6a95bc05353b4a68c07fc710742b9bcdc7d0d
Author: A. Walton <awalton gnome org>
Date:   Mon Aug 3 14:55:19 2009 -0400

    Fix crash in connect server dialog
    
    Under custom locations, entering no URI will crash.

 src/nautilus-connect-server-dialog.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index 3558024..cbae534 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -180,23 +180,26 @@ connect_to_server (NautilusConnectServerDialog *dialog)
 	g_assert (index < G_N_ELEMENTS (methods) && index >= 0);
 	meth = &(methods[index]);
 
+	uri = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->server_entry), 0, -1);
+	if (strlen (uri) == 0) {
+		eel_show_error_dialog (_("Cannot Connect to Server. You must enter a name for the server."), 
+				       _("Please enter a name and try again."), 
+				       GTK_WINDOW (dialog));
+		g_free (uri);
+		return;
+	}
+
 	if (meth->scheme == NULL) {
 		uri = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->uri_entry), 0, -1);
 		/* FIXME: we should validate it in some way? */
 	} else {
-		char *user, *port, *initial_path, *server, *folder ,*domain ;
+		char *user, *port, *initial_path, *server, *folder, *domain;
 		char *t, *join;
 		gboolean free_initial_path, free_user, free_domain, free_port;
-
-		server = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->server_entry), 0, -1);
-		if (strlen (server) == 0) {
-			eel_show_error_dialog (_("Cannot Connect to Server. You must enter a name for the server."), 
-					       _("Please enter a name and try again."), 
-					       GTK_WINDOW (dialog));
-			g_free (server);
-			return;
-		}
 		
+		server = uri;
+		uri = NULL;
+
 		user = "";
 		port = "";
 		initial_path = "";



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