mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[import matcher] NULL protect g_utf8_normalize
It crashes if fed a NULL string. May fix https://bugs.gnucash.org/show_bug.cgi?id=798483.
This commit is contained in:
parent
396c59e3d7
commit
4d6dc384ee
@ -875,23 +875,33 @@ update_desc_and_notes (const GNCImportTransInfo* trans_info)
|
|||||||
|
|
||||||
if (trans_info->append_text)
|
if (trans_info->append_text)
|
||||||
{
|
{
|
||||||
gchar* desc_imported = g_utf8_normalize (xaccTransGetDescription (
|
gchar *desc_imported, *desc_matched, *note_imported, *note_matched;
|
||||||
imp_trans), -1, G_NORMALIZE_ALL);
|
const gchar* raw_str = xaccTransGetDescription (imp_trans);
|
||||||
gchar* desc_matched = g_utf8_normalize (xaccTransGetDescription (
|
|
||||||
selected_match->trans), -1, G_NORMALIZE_ALL);
|
desc_imported =
|
||||||
gchar* note_imported = g_utf8_normalize (xaccTransGetNotes (
|
raw_str ? g_utf8_normalize (raw_str, -1, G_NORMALIZE_ALL) : NULL;
|
||||||
imp_trans), -1, G_NORMALIZE_ALL);
|
raw_str = xaccTransGetDescription (selected_match->trans);
|
||||||
gchar* note_matched = g_utf8_normalize (xaccTransGetNotes (
|
desc_matched =
|
||||||
selected_match->trans), -1, G_NORMALIZE_ALL);
|
raw_str ? g_utf8_normalize (raw_str, -1, G_NORMALIZE_ALL) : NULL;
|
||||||
|
raw_str = xaccTransGetNotes (imp_trans);
|
||||||
|
note_imported =
|
||||||
|
raw_str ? g_utf8_normalize (raw_str, -1, G_NORMALIZE_ALL) : NULL;
|
||||||
|
raw_str = xaccTransGetNotes (selected_match->trans);
|
||||||
|
note_matched =
|
||||||
|
raw_str ? g_utf8_normalize (raw_str, -1, G_NORMALIZE_ALL) : NULL;
|
||||||
|
|
||||||
// Append if desc_imported not already in desc_matched
|
// Append if desc_imported not already in desc_matched
|
||||||
if (g_utf8_strlen (desc_imported, -1) > g_utf8_strlen (desc_matched, -1) ||
|
if (desc_imported &&
|
||||||
!strstr (desc_matched, desc_imported))
|
(!desc_matched ||
|
||||||
|
g_utf8_strlen (desc_imported, -1) > g_utf8_strlen (desc_matched, -1) ||
|
||||||
|
!strstr (desc_matched, desc_imported)))
|
||||||
desc_append (selected_match->trans, imp_trans);
|
desc_append (selected_match->trans, imp_trans);
|
||||||
|
|
||||||
// Append if note_imported not already in note_matched
|
// Append if note_imported not already in note_matched
|
||||||
if (g_utf8_strlen (note_imported, -1) > g_utf8_strlen (note_matched, -1) ||
|
if (note_imported &&
|
||||||
!strstr (note_matched, note_imported))
|
(!note_matched ||
|
||||||
|
g_utf8_strlen (note_imported, -1) > g_utf8_strlen (note_matched, -1) ||
|
||||||
|
!strstr (note_matched, note_imported)))
|
||||||
notes_append (selected_match->trans, imp_trans);
|
notes_append (selected_match->trans, imp_trans);
|
||||||
|
|
||||||
g_free(desc_imported);
|
g_free(desc_imported);
|
||||||
|
Loading…
Reference in New Issue
Block a user