This is an automated email from the ASF dual-hosted git repository.
jleroux 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 7d7448edf4 Fixed: Improvement of the Check xml tag (OFBIZ-12821)
7d7448edf4 is described below
commit 7d7448edf4de13d64e4d74c09ac4574d9d3767a1
Author: Jacques Le Roux <[email protected]>
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 39a7acf1a4..fc1b87b818 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)) {