maektwain commented on a change in pull request #926: URL: https://github.com/apache/fineract/pull/926#discussion_r429437269
########## File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java ########## @@ -517,9 +517,11 @@ private LoanScheduleModelPeriod handleRecalculationForTransactions(final MathCon scheduleParams.getTotalCumulativePrincipal().plus( currentPeriodParams.getPrincipalForThisPeriod().minus(principalProcessed)), scheduleParams.getPeriodNumber() + 1, mc)); - if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment() - && fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) { - currentPeriodParams.setEmiAmountChanged(true); + if (loanApplicationTerms.getAmortizationMethod().isEqualInstallment()) + if(fixedEmiAmount != null) { + if (fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0) { Review comment: This part is based on the fact that `fixedEmiAmount.compareTo(loanApplicationTerms.getFixedEmiAmount()) != 0)` fixedEmiAmount is not going to be null ? It will fail even if loanApplicationTerms.getFixedEmiAmount() this is going to be null, since the first hand requires not to be null. We need to broadly think of the null checks in the application, this way we can make code more clean and easier to such edge cases, In my opinion there are many places like this where null values are sometimes checked and if the field dependent to some fields is not logically set it fails at null exception ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org