[email protected] wrote:
> Author: jleroux
> Date: Fri Mar 26 14:34:02 2010
> New Revision: 927870
> 
> URL: http://svn.apache.org/viewvc?rev=927870&view=rev
> Log:
> Fix a NPE I got on actualCurrencyAmount while working with R9.04. 
> Since the files are identical I commit in trunk and will backport
> 
> Modified:
>     
> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy
> 
> Modified: 
> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy?rev=927870&r1=927869&r2=927870&view=diff
> ==============================================================================
> --- 
> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy
>  (original)
> +++ 
> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy
>  Fri Mar 26 14:34:02 2010
> @@ -68,13 +68,19 @@ List getPayments(List payments, boolean 
>              if (actual) {
>                  paymentMap.amount = payment.actualCurrencyAmount;
>                  paymentMap.currencyUomId = payment.actualCurrencyUomId;
> -                paymentToApply = 
> payment.getBigDecimal("actualCurrencyAmount").setScale(decimals,rounding).subtract(paymentApplied);
> +                paymentToApply = 
> payment.getBigDecimal("actualCurrencyAmount");
> +                if (paymentToApply) {
> +                    paymentToApply = 
> paymentToApply.setScale(decimals,rounding).subtract(paymentApplied);
> +                }

paymentToApply =
payment.getBigDecimal("actualCurrencyAmount")?.setScale(decimals,
rounding).subtract(paymentApplied);

That's better groovy syntax.


Reply via email to