mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-24 23:27:39 -05:00
[gnc-budget.cpp] null check arguments *before* accessing them
This commit is contained in:
1 parent
4490130eef
commit
55856c63dd
1 file changed
+6
-6
@@ -541,6 +541,9 @@ void
|
||||
gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
|
||||
guint period_num, gnc_numeric val)
|
||||
{
|
||||
g_return_if_fail (budget != nullptr);
|
||||
g_return_if_fail (account != nullptr);
|
||||
|
||||
/* Watch out for an off-by-one error here:
|
||||
* period_num starts from 0 while num_periods starts from 1 */
|
||||
if (period_num >= GET_PRIVATE(budget)->num_periods)
|
||||
@@ -549,9 +552,6 @@ gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
|
||||
return;
|
||||
}
|
||||
|
||||
g_return_if_fail (budget != nullptr);
|
||||
g_return_if_fail (account != nullptr);
|
||||
|
||||
auto& perioddata = get_perioddata (budget, account, period_num);
|
||||
auto budget_kvp { QOF_INSTANCE (budget)->kvp_data };
|
||||
auto path = make_period_data_path (account, period_num);
|
||||
@@ -600,6 +600,9 @@ void
|
||||
gnc_budget_set_account_period_note(GncBudget *budget, const Account *account,
|
||||
guint period_num, const gchar *note)
|
||||
{
|
||||
g_return_if_fail (budget != nullptr);
|
||||
g_return_if_fail (account != nullptr);
|
||||
|
||||
/* Watch out for an off-by-one error here:
|
||||
* period_num starts from 0 while num_periods starts from 1 */
|
||||
if (period_num >= GET_PRIVATE(budget)->num_periods)
|
||||
@@ -608,9 +611,6 @@ gnc_budget_set_account_period_note(GncBudget *budget, const Account *account,
|
||||
return;
|
||||
}
|
||||
|
||||
g_return_if_fail (budget != nullptr);
|
||||
g_return_if_fail (account != nullptr);
|
||||
|
||||
auto& perioddata = get_perioddata (budget, account, period_num);
|
||||
auto budget_kvp { QOF_INSTANCE (budget)->kvp_data };
|
||||
auto path = make_period_note_path (account, period_num);
|
||||
|
||||
Reference in new issue
Block a user