Skip to content

Commit

Permalink
Fixed: Improvement of the Check xml tag (OFBIZ-12821)
Browse files Browse the repository at this point in the history
Fixes a NPE bug reported by Michael

Thanks: Michael Brohl
  • Loading branch information
JacquesLeRoux committed Feb 3, 2025
1 parent 64214ce commit 7d7448e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,13 @@ public void renderCheckField(Appendable writer, Map<String, Object> context, Che
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)) {
Expand Down

0 comments on commit 7d7448e

Please sign in to comment.