diff --git a/src/import-export/hbci/gnc-hbci-utils.c b/src/import-export/hbci/gnc-hbci-utils.c index 61d31ec77e..e3f0c11158 100644 --- a/src/import-export/hbci/gnc-hbci-utils.c +++ b/src/import-export/hbci/gnc-hbci-utils.c @@ -460,6 +460,7 @@ static void *gnc_list_string_cb (const char *string, void *user_data) gchar **res = user_data; gchar *tmp1, *tmp2; + if (!string) return NULL; tmp1 = g_strdup (string); g_strstrip (tmp1); @@ -487,17 +488,21 @@ char *gnc_hbci_descr_tognc (const AB_TRANSACTION *h_trans) char *h_descr = NULL; char *othername = NULL; char *g_descr; + const GWEN_STRINGLIST *h_purpose = AB_Transaction_GetPurpose (h_trans); + const GWEN_STRINGLIST *h_remotename = AB_Transaction_GetRemoteName (h_trans); /* Don't use list_string_concat_delim here since we need to g_strstrip every single element of the string list, which is only done in our callback gnc_list_string_cb. The separator is also set there. */ - GWEN_StringList_ForEach (AB_Transaction_GetPurpose (h_trans), - &gnc_list_string_cb, - &h_descr); - GWEN_StringList_ForEach (AB_Transaction_GetRemoteName (h_trans), - &gnc_list_string_cb, - &othername); + if (h_purpose) + GWEN_StringList_ForEach (h_purpose, + &gnc_list_string_cb, + &h_descr); + if (h_remotename) + GWEN_StringList_ForEach (h_remotename, + &gnc_list_string_cb, + &othername); /*DEBUG("HBCI Description '%s'", h_descr);*/ if (othername && (strlen (othername) > 0)) @@ -524,10 +529,14 @@ char *gnc_hbci_memo_tognc (const AB_TRANSACTION *h_trans) * "STANDING ORDER", "UEBERWEISUNGSGUTSCHRIFT", etc. */ /* char *h_transactionText = */ /* g_strdup (AB_TRANSACTION_transactionText (h_trans)); */ + const char *h_remoteAccountNumber = + AB_Transaction_GetRemoteAccountNumber (h_trans); + const char *h_remoteBankCode = + AB_Transaction_GetRemoteBankCode (h_trans); char *h_otherAccountId = - g_strdup (AB_Transaction_GetRemoteAccountNumber (h_trans)); + g_strdup (h_remoteAccountNumber ? h_remoteAccountNumber : _("unknown")); char *h_otherBankCode = - g_strdup (AB_Transaction_GetRemoteBankCode (h_trans)); + g_strdup (h_remoteBankCode ? h_remoteBankCode : _("unknown")); char *g_memo; /* g_strstrip (h_transactionText); */ diff --git a/src/import-export/hbci/hbci-interaction.c b/src/import-export/hbci/hbci-interaction.c index 82ed5a17d6..8c8529141e 100644 --- a/src/import-export/hbci/hbci-interaction.c +++ b/src/import-export/hbci/hbci-interaction.c @@ -544,6 +544,8 @@ static GWEN_TYPE_UINT32 progressStartCB(AB_BANKING *ab, const char *utf8title, 0.0); data->action_max = total; GNCInteractor_setRunning(data); + printf("progressStartCB: Action \"%s\" started, total %d.\n", + text, total); /* Show the dialog */ GNCInteractor_show(data); @@ -563,13 +565,15 @@ static int progressAdvanceCB(AB_BANKING *ab, GWEN_TYPE_UINT32 id, g_assert(data); if ((id != 0) && (id != progress_id)) { - printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); +/* printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); */ } if (progress != AB_BANKING_PROGRESS_NONE) { - printf("progressLogCB: Setting progress to %d out of %f.\n", progress, data->action_max); - gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), - progress/data->action_max); + printf("progressLogCB: Progress set to %d out of %f.\n", + progress, data->action_max); + if (progress <= data->action_max) + gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), + progress/data->action_max); } keepAlive(data); @@ -590,7 +594,7 @@ static int progressLogCB(AB_BANKING *ab, GWEN_TYPE_UINT32 id, text = gnc_hbci_utf8ToLatin1(data, utf8text); if ((id != 0) && (id != progress_id)) { - printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); +/* printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); */ } printf("progressLogCB: Logging msg: %s\n", text); @@ -609,7 +613,7 @@ static int progressEndCB(AB_BANKING *ab, GWEN_TYPE_UINT32 id) g_assert(data); if ((id != 0) && (id != progress_id)) { - printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); +/* printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); */ } GNCInteractor_setFinished(data);