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
This commit is contained in:
Phil Longstaff 2009-11-27 03:13:41 +00:00
parent a001f55fce
commit d0f22524ee

View File

@ -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 ) {