[assistant-stock-transaction.cpp] don't copy SplitsVec

This commit is contained in:
Christopher Lam 2024-06-18 08:26:48 +08:00
parent cd097d19ec
commit f19e462098

View File

@ -1263,7 +1263,7 @@ StockAssistantModel::set_txn_type (guint type_idx)
};
static void
check_txn_date(Split* last_split, time64 txn_date, Logger& logger)
check_txn_date(const Split* last_split, time64 txn_date, Logger& logger)
{
auto last_split_date = xaccTransGetDate(xaccSplitGetParent(last_split));
if (txn_date <= last_split_date) {
@ -1301,8 +1301,7 @@ StockAssistantModel::generate_list_of_splits() {
// transactions dated after the date specified, it is very likely
// the later stock transactions will be invalidated. warn the user
// to review them.
auto splits{xaccAccountGetSplits (m_acct)};
if (!splits.empty())
if (const auto& splits = xaccAccountGetSplits (m_acct); !splits.empty())
check_txn_date(splits.back(), m_transaction_date, m_logger);
if (m_stock_entry->enabled() || m_stock_entry->has_amount())