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 d41cbe11fb Fixed: createUpdateBillingAddressAndPaymentMethod throws
NPE for anonymous checkout (OFBIZ-13584)
d41cbe11fb is described below
commit d41cbe11fbb70378643d17ab84ee8c485f54b0ce
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 15 17:13:38 2026 +0530
Fixed: createUpdateBillingAddressAndPaymentMethod throws NPE for anonymous
checkout (OFBIZ-13584)
The method dereferenced userLogin.userLoginId without checking userLogin
for null first, throwing a NullPointerException whenever a partyId is present
but the shopping cart has no associated userLogin (an anonymous checkout
carrying a resolved party from elsewhere). The original minilang's dotted-field
access degraded gracefully to null in that case instead of crashing. The guard
now checks userLogin is non-null before accessing userLoginId, matching the
pattern already used in the si [...]
---
.../main/groovy/org/apache/ofbiz/order/order/CheckoutServices.groovy | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CheckoutServices.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CheckoutServices.groovy
index 8f73521ee4..a0780af969 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CheckoutServices.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CheckoutServices.groovy
@@ -136,7 +136,7 @@ Map createUpdateBillingAddressAndPaymentMethod() {
shipToContactMechId = shipToContactMechId ?:
shoppingCart.getShippingContactMechId()
}
if (partyId) {
- if (userLogin.userLoginId == 'anonymous') {
+ if (userLogin && userLogin.userLoginId == 'anonymous') {
userLogin.partyId = partyId
}
}