Skip to content

Commit c693016

Browse files
Changed attribute modification process to check first if the model contains the entityForm. This avoids a NPE that was happening when the entity type was not selected (before the entityForm exists). Fixes BroadleafCommerce/QA#1291.
1 parent 902435e commit c693016

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

admin/broadleaf-admin-module/src/main/java/org/broadleafcommerce/admin/web/controller/entity/AdminOfferController.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ public String addEntity(HttpServletRequest request, HttpServletResponse response
9999
*/
100100
protected void modifyModelAttributes(Model model) {
101101
model.addAttribute("additionalControllerClasses", "offer-form");
102-
EntityForm form = (EntityForm) model.asMap().get("entityForm");
103-
form.findField("targetItemCriteria").setRequired(true);
102+
if (model.asMap().containsKey("entityForm")) {
103+
EntityForm form = (EntityForm) model.asMap().get("entityForm");
104+
form.findField("targetItemCriteria").setRequired(true);
105+
}
104106
}
105107

106108
}

0 commit comments

Comments
 (0)