From d0f22524eee97d986a3ee9c00bb0ac0ea7bf8566 Mon Sep 17 00:00:00 2001 From: Phil Longstaff Date: Fri, 27 Nov 2009 03:13:41 +0000 Subject: [PATCH] Fix Bug 591573 - "File|Save As" with xml option and no file name crashes With no file name, entered, filename returned from file_chooser is NULL, which led to the crash. If NULL is returned, just ignore the button press. Proper UI would not allow Save As to be clicked unless conditions were right, but I'm not sure how to make that happen. There is a signal emitted when a file is selected, but not when characters are typed into the name text field. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18443 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome-utils/dialog-file-access.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gnome-utils/dialog-file-access.c b/src/gnome-utils/dialog-file-access.c index e7468d081c..00ee7a0b09 100644 --- a/src/gnome-utils/dialog-file-access.c +++ b/src/gnome-utils/dialog-file-access.c @@ -79,6 +79,9 @@ geturl( FileAccessWindow* faw ) type = gtk_combo_box_get_active_text( faw->cb_uri_type ); if( strcmp( type, "xml" ) == 0 ) { + if( file == NULL ) { + return NULL; + } url = g_strdup_printf( "xml://%s", file ); } else if( strcmp( type, "sqlite3" ) == 0 ) { url = g_strdup_printf( "sqlite3://%s", file ); @@ -115,6 +118,9 @@ gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unus case GTK_RESPONSE_OK: url = geturl( faw ); + if( url == NULL ) { + return; + } if( faw->type == FILE_ACCESS_OPEN ) { gnc_file_open_file( url ); } else if( faw->type == FILE_ACCESS_SAVE_AS ) {