mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 797532 - Crash/Coredump Lots
Replace the asserts in cap-gains.c with g_return_val_if_fail. There's nothing about cap-gains.c that justifies crashing the program.
This commit is contained in:
parent
3bab92367a
commit
d51b4d7f08
@ -336,7 +336,7 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
|
||||
amt_tot = split->amount;
|
||||
amt_a = gnc_numeric_neg (baln);
|
||||
amt_b = gnc_numeric_sub_fixed (amt_tot, amt_a);
|
||||
g_assert (gnc_numeric_check(amt_b) == GNC_ERROR_OK);
|
||||
g_return_val_if_fail(gnc_numeric_check(amt_b) == GNC_ERROR_OK, NULL);
|
||||
|
||||
PINFO ("++++++++++++++ splitting split=%p into amt = %s + %s",
|
||||
split,
|
||||
@ -366,7 +366,7 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
|
||||
gnc_num_dbg_to_string(amt_tot));
|
||||
}
|
||||
|
||||
if (gnc_numeric_zero_p(val_a) || gnc_numeric_zero_p(val_b))
|
||||
if (gnc_numeric_zero_p(amt_a) || gnc_numeric_zero_p(amt_b))
|
||||
{
|
||||
PERR ("Failed to split into two!");
|
||||
}
|
||||
@ -376,8 +376,8 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
|
||||
gnc_num_dbg_to_string(val_a),
|
||||
gnc_num_dbg_to_string(val_b) );
|
||||
|
||||
g_assert (!gnc_numeric_zero_p (amt_a));
|
||||
g_assert (!gnc_numeric_zero_p (val_a));
|
||||
g_return_val_if_fail (!gnc_numeric_zero_p (amt_a), NULL);
|
||||
g_return_val_if_fail (!gnc_numeric_check (val_a), NULL);
|
||||
xaccSplitSetAmount (split, amt_a);
|
||||
xaccSplitSetValue (split, val_a);
|
||||
|
||||
@ -438,8 +438,8 @@ xaccSplitAssign (Split *split)
|
||||
* have lots, we are done.
|
||||
*/
|
||||
if (split->lot) return FALSE;
|
||||
g_assert (split->gains == GAINS_STATUS_UNKNOWN ||
|
||||
(split->gains & GAINS_STATUS_GAINS) == FALSE);
|
||||
g_return_val_if_fail (split->gains == GAINS_STATUS_UNKNOWN ||
|
||||
(split->gains & GAINS_STATUS_GAINS) == FALSE, FALSE);
|
||||
acc = split->acc;
|
||||
if (!xaccAccountHasTrades (acc))
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user