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/29 16:19:09 UTC

(ofbiz-framework) branch trunk updated: Fixed: Two missing null-guards in CommunicationEventServicesScript.groovy (OFBIZ-13623)

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 c29e4aeb76 Fixed: Two missing null-guards in CommunicationEventServicesScript.groovy (OFBIZ-13623)
c29e4aeb76 is described below

commit c29e4aeb7612a82e02d6d7879afbb22c77281aa8
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Tue Sep 29 19:52:31 2026 +0530

    Fixed: Two missing null-guards in CommunicationEventServicesScript.groovy (OFBIZ-13623)
    
    - setCommunicationEventStatus() dot-accessed communicationEvent.statusId with no guard after queryOne(), throwing an NPE for a missing event instead of the clean no-op mini-lang produced. Direct sibling of the fix already applied to setCommunicationEventRoleStatus() (OFBIZ-13591).
    - sendContactUsEmailToCompany(), a public unauthenticated Contact Us handler, dot-accessed productStoreEmailSetting.bodyScreenLocation with no guard; since productStoreId/emailType are optional, an unconfigured setting threw an NPE after the CommunicationEvent had already been created.
---
 .../party/communication/CommunicationEventServicesScript.groovy     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/communication/CommunicationEventServicesScript.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/communication/CommunicationEventServicesScript.groovy
index 7eb643c465..7d518f4661 100644
--- a/applications/party/src/main/groovy/org/apache/ofbiz/party/communication/CommunicationEventServicesScript.groovy
+++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/communication/CommunicationEventServicesScript.groovy
@@ -513,6 +513,10 @@ Map setCommunicationEventStatus() {
     GenericValue communicationEvent = from('CommunicationEvent')
             .where(parameters)
             .queryOne()
+    if (!communicationEvent) {
+        return success()
+    }
+
     String oldStatusId = communicationEvent.statusId
     if (parameters.statusId != oldStatusId) {
         if (oldStatusId) {
@@ -639,7 +643,7 @@ Map sendContactUsEmailToCompany() {
                           postalCode: parameters.postalCode, countryCode: parameters.countryCode,
                           message: parameters.content]
 
-    if (productStoreEmailSetting.bodyScreenLocation) {
+    if (productStoreEmailSetting?.bodyScreenLocation) {
         Map emailParams = [bodyParameters: bodyParameters, userLogin: systemUserLogin]
         if (getPartyEmailResult.emailAddress) {
             emailParams.sendTo = getPartyEmailResult.emailAddress