[assistant-stock-transsaction] skip checking txn_date for empty stock acct

This commit is contained in:
Christopher Lam 2022-05-06 09:01:35 +08:00
parent 674b49bd8d
commit 19803ba9d0

View File

@ -703,7 +703,10 @@ refresh_page_finish (StockTransactionInfo *info)
// the later stock transactions will be invalidated. warn the user // the later stock transactions will be invalidated. warn the user
// to review them. // to review them.
auto new_date = gnc_date_edit_get_date_end (GNC_DATE_EDIT (info->date_edit)); auto new_date = gnc_date_edit_get_date_end (GNC_DATE_EDIT (info->date_edit));
auto last_split = static_cast<const Split*> (g_list_last (xaccAccountGetSplitList (info->acct))->data); auto last_split_node = g_list_last (xaccAccountGetSplitList (info->acct));
if (last_split_node)
{
auto last_split = static_cast<const Split*> (last_split_node->data);
auto last_split_date = xaccTransGetDate (xaccSplitGetParent (last_split)); auto last_split_date = xaccTransGetDate (xaccSplitGetParent (last_split));
if (new_date <= last_split_date) if (new_date <= last_split_date)
{ {
@ -722,6 +725,7 @@ to ensure proper recording."), new_date_str, last_split_date_str);
g_free (new_date_str); g_free (new_date_str);
g_free (last_split_date_str); g_free (last_split_date_str);
} }
}
if (info->txn_type->stock_amount != FieldMask::DISABLED) if (info->txn_type->stock_amount != FieldMask::DISABLED)
{ {