Bug #572107: Use fallback string for OFX account types when matching to GnuCash accounts.

Without the fallback, NULL is printf'ed which crashes GnuCash on
Windows.
BP


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17965 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2009-02-26 22:12:51 +00:00
parent 48c7f72430
commit ea478541e9

View File

@ -560,7 +560,7 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
gnc_commodity * default_commodity; gnc_commodity * default_commodity;
GNCAccountType default_type=ACCT_TYPE_NONE; GNCAccountType default_type=ACCT_TYPE_NONE;
gchar * account_description; gchar * account_description;
gchar * account_type_name = NULL; const gchar * account_type_name = _("Unknown OFX account");
if(data.account_id_valid==true){ if(data.account_id_valid==true){
commodity_table = gnc_get_current_commodities (); commodity_table = gnc_get_current_commodities ();
@ -580,31 +580,31 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
switch(data.account_type){ switch(data.account_type){
case OFX_CHECKING : case OFX_CHECKING :
default_type=ACCT_TYPE_BANK; default_type=ACCT_TYPE_BANK;
account_type_name = g_strdup_printf(_("Unknown OFX checking account")); account_type_name = _("Unknown OFX checking account");
break; break;
case OFX_SAVINGS : case OFX_SAVINGS :
default_type=ACCT_TYPE_BANK; default_type=ACCT_TYPE_BANK;
account_type_name = g_strdup_printf(_("Unknown OFX savings account")); account_type_name = _("Unknown OFX savings account");
break; break;
case OFX_MONEYMRKT : case OFX_MONEYMRKT :
default_type=ACCT_TYPE_MONEYMRKT; default_type=ACCT_TYPE_MONEYMRKT;
account_type_name = g_strdup_printf(_("Unknown OFX money market account")); account_type_name = _("Unknown OFX money market account");
break; break;
case OFX_CREDITLINE : case OFX_CREDITLINE :
default_type=ACCT_TYPE_CREDITLINE; default_type=ACCT_TYPE_CREDITLINE;
account_type_name = g_strdup_printf(_("Unknown OFX credit line account")); account_type_name = _("Unknown OFX credit line account");
break; break;
case OFX_CMA : case OFX_CMA :
default_type=ACCT_TYPE_NONE; default_type=ACCT_TYPE_NONE;
account_type_name = g_strdup_printf(_("Unknown OFX CMA account")); account_type_name = _("Unknown OFX CMA account");
break; break;
case OFX_CREDITCARD : case OFX_CREDITCARD :
default_type=ACCT_TYPE_CREDIT; default_type=ACCT_TYPE_CREDIT;
account_type_name = g_strdup_printf(_("Unknown OFX credit card account")); account_type_name = _("Unknown OFX credit card account");
break; break;
case OFX_INVESTMENT : case OFX_INVESTMENT :
default_type=ACCT_TYPE_BANK; default_type=ACCT_TYPE_BANK;
account_type_name = g_strdup_printf(_("Unknown OFX investment account")); account_type_name = _("Unknown OFX investment account");
break; break;
default: PERR("WRITEME: ofx_proc_account() This is an unknown account type!"); default: PERR("WRITEME: ofx_proc_account() This is an unknown account type!");
} }
@ -623,7 +623,6 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
account_description, default_commodity, account_description, default_commodity,
default_type, NULL, NULL); default_type, NULL, NULL);
g_free(account_description); g_free(account_description);
g_free(account_type_name);
} }
else else
{ {