Skip to content

Commit

Permalink
Bug 799444 - Silent crash on CSV import
Browse files Browse the repository at this point in the history
Don't try to add a transaction with no splits to the imported
transaction list, gnc_gen_trans_list_add_trans_internal asserts.
  • Loading branch information
jralls committed Dec 12, 2024
1 parent 4e8058c commit 81e11f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,12 @@ CsvImpTransAssist::assist_match_page_prepare ()
draft_trans->m_trec_date ? static_cast<time64>(GncDateTime(*draft_trans->m_trec_date, DayPart::neutral)) : 0,
};

gnc_gen_trans_list_add_trans_with_split_data (gnc_csv_importer_gui, std::move (draft_trans->trans), &lsplit);
//A tramsaction with no splits is invalid and will crash later.
if (xaccTransGetSplit(draft_trans->trans, 0))
gnc_gen_trans_list_add_trans_with_split_data (gnc_csv_importer_gui, std::move (draft_trans->trans),
&lsplit);
else
xaccTransDestroy(draft_trans->trans);
draft_trans->trans = nullptr;
}
}
Expand Down

0 comments on commit 81e11f7

Please sign in to comment.