fix possible NPE in AbstractLoanScheduleGenerator

This commit is contained in:
Saransh Sharma
2020-06-01 21:53:02 +02:00
committed by Michael Vorburger ⛑️
parent aed3e41ca4
commit b6e6eba56f
@@ -517,10 +517,11 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
scheduleParams.getTotalCumulativePrincipal().plus( scheduleParams.getTotalCumulativePrincipal().plus(
currentPeriodParams.getPrincipalForThisPeriod().minus(principalProcessed)), currentPeriodParams.getPrincipalForThisPeriod().minus(principalProcessed)),
scheduleParams.getPeriodNumber() + 1, mc)); scheduleParams.getPeriodNumber() + 1, mc));
if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment() if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
&& fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) { && fixedEmiAmount != null
currentPeriodParams.setEmiAmountChanged(true); && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
} currentPeriodParams.setEmiAmountChanged(true);
}
} }
adjustCompoundedAmountWithPaidDetail(scheduleParams, lastRestDate, currentTransactions, loanApplicationTerms, adjustCompoundedAmountWithPaidDetail(scheduleParams, lastRestDate, currentTransactions, loanApplicationTerms,
@@ -636,10 +637,12 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
scheduleParams.getReducePrincipal(), scheduleParams.getReducePrincipal(),
scheduleParams.getTotalCumulativePrincipal().plus(currentPeriodParams.getPrincipalForThisPeriod()) scheduleParams.getTotalCumulativePrincipal().plus(currentPeriodParams.getPrincipalForThisPeriod())
.plus(currentPeriodParams.getEarlyPaidAmount()), scheduleParams.getPeriodNumber() + 1, mc)); .plus(currentPeriodParams.getEarlyPaidAmount()), scheduleParams.getPeriodNumber() + 1, mc));
if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment() if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()
&& fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) { && fixedEmiAmount != null
currentPeriodParams.setEmiAmountChanged(true); && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) {
} currentPeriodParams.setEmiAmountChanged(true);
currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount());
}
currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount()); currentPeriodParams.plusPrincipalForThisPeriod(currentPeriodParams.getEarlyPaidAmount());
} }