fix null pointer exception

This commit is contained in:
Ralph Soika 2023-06-13 11:01:33 +02:00
parent 7902df76a9
commit d8bfc6ce39

View file

@ -189,21 +189,27 @@ public class OPListController implements Serializable {
// finally we set the 'selection' item depending on the $workitemList // finally we set the 'selection' item depending on the $workitemList
// and the payment amount form the 'payment.details' // and the payment amount form the 'payment.details'
List<String> selection = workflowController.getWorkitem().getItemValue("$workitemref"); if (invoiceList!=null) {
List<ItemCollection> paymentList = zahlungseingangService.loadPaymentDetails(workflowController.getWorkitem()); List<String> selection = workflowController.getWorkitem().getItemValue("$workitemref");
for (ItemCollection invoice : invoiceList) { List<ItemCollection> paymentList = zahlungseingangService.loadPaymentDetails(workflowController.getWorkitem());
if (selection.contains(invoice.getUniqueID())) { for (ItemCollection invoice : invoiceList) {
invoice.setItemValue("selected", true); if (selection.contains(invoice.getUniqueID())) {
// set amount invoice.setItemValue("selected", true);
for (ItemCollection payment : paymentList) { // set amount
if (invoice.getUniqueID().equals(payment.getUniqueID())) { for (ItemCollection payment : paymentList) {
invoice.setItemValue("payment.amount", payment.getItemValue("payment.amount")); if (invoice.getUniqueID().equals(payment.getUniqueID())) {
break; invoice.setItemValue("payment.amount", payment.getItemValue("payment.amount"));
break;
}
} }
} }
} }
} else {
// empty list
invoiceList = new ArrayList<ItemCollection>();
} }
return invoiceList; return invoiceList;
} }