Skip to content

Commit

Permalink
Going back from 'Qif files you have loaded' crashes
Browse files Browse the repository at this point in the history
Once you have unloaded all files on the above page and go back Gnucash
will crash as it was using an invalid file, check for selected_file in
the ...import_account_prepare function.
  • Loading branch information
Bob-IT committed May 12, 2019
1 parent 29063fc commit 1dc99f1
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions gnucash/import-export/qif-imp/assistant-qif-import.c
Expand Up @@ -2104,21 +2104,32 @@ gnc_ui_qif_import_account_prepare (GtkAssistant *assistant, gpointer user_data)

if (wind->ask_date_format && wind->date_format)
qif_import_reparse_dates (wind);
/* Determine the next page to display. */
if (scm_call_1 (check_from_acct, wind->selected_file) != SCM_BOOL_T)
{
/* There is an account name missing. Ask the user to provide one. */
SCM default_acct = scm_c_eval_string ("qif-file:path-to-accountname");
gchar * default_acctname = NULL;

default_acctname = gnc_scm_call_1_to_string (default_acct, wind->selected_file);
gtk_entry_set_text (GTK_ENTRY(wind->acct_entry), default_acctname);
g_free (default_acctname);
/* make sure there is a file selected, may of come back */
if (wind->selected_file == SCM_BOOL_F)
{
GtkAssistant *assistant = GTK_ASSISTANT(wind->window);
gtk_entry_set_text (GTK_ENTRY(wind->filename_entry), "");
gtk_assistant_set_current_page (assistant, 1);
}
else
{
/* Skip ahead to the "loaded files" page. */
gtk_assistant_set_current_page (assistant, num + 1);
/* Determine the next page to display. */
if (scm_call_1 (check_from_acct, wind->selected_file) != SCM_BOOL_T)
{
/* There is an account name missing. Ask the user to provide one. */
SCM default_acct = scm_c_eval_string ("qif-file:path-to-accountname");
gchar * default_acctname = NULL;

default_acctname = gnc_scm_call_1_to_string (default_acct, wind->selected_file);
gtk_entry_set_text (GTK_ENTRY(wind->acct_entry), default_acctname);
g_free (default_acctname);
}
else
{
/* Skip ahead to the "loaded files" page. */
gtk_assistant_set_current_page (assistant, num + 1);
}
}
}

Expand Down

0 comments on commit 1dc99f1

Please sign in to comment.