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

jleroux 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 c283e57df6 Fixed: Improvement of the Check xml tag (OFBIZ-12821)
c283e57df6 is described below

commit c283e57df63dab31d0d15c1569fb33ee5e4e891d
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Mon Feb 3 17:07:14 2025 +0100

    Fixed: Improvement of the Check xml tag (OFBIZ-12821)
    
    Fixes a NPE bug reported by Michael
    
    Thanks: Michael Brohl
---
 .../org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
index c7d13be353..28c9b4e79f 100644
--- 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
+++ 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
@@ -296,10 +296,13 @@ public final class MacroFormRenderer implements 
FormStringRenderer {
         StringBuilder items = new StringBuilder();
         String checkBox = checkField.getModelFormField().getAttributeName();
         List<String> checkedByDefault = new ArrayList<String>();
-        if (context.containsKey(checkBox) && 
!context.get(checkBox).getClass().equals(String.class)) {
+
+        if (context.containsKey(checkBox) && context.get(checkBox) != null
+                && !context.get(checkBox).getClass().equals(String.class)) {
             checkedByDefault = context.containsKey(checkBox) ? 
StringUtil.toList(context.get(checkBox).toString())
                     : List.of();
         }
+
         if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) {
             className = modelFormField.getWidgetStyle();
             if (modelFormField.shouldBeRed(context)) {

Reply via email to