This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 71299e9b71 Fixed: voidPayment throws on a non-invoice payment 
application (OFBIZ-13560)
71299e9b71 is described below

commit 71299e9b7170e917b36f3d684cd587feb8384d87
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 8 14:11:27 2026 +0530

    Fixed: voidPayment throws on a non-invoice payment application (OFBIZ-13560)
    
    voidPayment threw a null-dereference crash when voiding a payment with any 
non-invoice-linked PaymentApplication (one applied to a billing account, 
another payment, a GL account, or a tax authority) - the query for the 
associated invoice legitimately returns nothing in that case, and the following 
status check dereferenced it unconditionally. Minilang's equivalent 
<get-related-one>/<if-compare> combination safely skipped this case; the Groovy 
version now does the same via a null-safe check.
---
 .../groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
index 8a58107cec..3fadc2a2e0 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
@@ -373,7 +373,7 @@ Map voidPayment() {
         .queryList()
         .each { it ->
             Map invoice = from('Invoice').where(invoiceId: 
it.invoiceId).queryOne()
-            if (invoice.statusId == 'INVOICE_PAID') {
+            if (invoice?.statusId == 'INVOICE_PAID') {
                 run service: 'setInvoiceStatus', with: [*: 
invoice.getAllFields(),
                                                         paidDate: null,
                                                         statusId: 
'INVOICE_READY']

Reply via email to