You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/09/08 10:22:44 UTC

(ofbiz-framework) branch release24.09 updated: Fixed: voidPayment throws on a non-invoice payment application (OFBIZ-13560)

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

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


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

commit db92edd60f0698c84c83108b8a3ddbfcc05c95ec
Author: Mridul Pathak <mr...@gmail.com>
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']