Code used to try to divide by zero. Fixed it to always check for the
denominator being 0 beforehand.
BUG: 402708
tbaumgart |
KMyMoney |
Code used to try to divide by zero. Fixed it to always check for the
denominator being 0 beforehand.
BUG: 402708
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
I tested, that the testcase catches the problem and applied the patch which works as expected on the testcase. Good catch. Please see my minor resource usage improvements.
kmymoney/plugins/views/reports/core/querytable.cpp | ||
---|---|---|
363 | Change denominator == 0 to denominator.isZero() which is faster. | |
1062 | Use if (!(startingBal - buys).isZero()) { here. | |
1461 | Change buysTotal.abs() == 0 to buysTotal.isZero() and save more CPU cycles. No need to take the absolute value of zero. |