diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java b/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java index af0d9b9c19..ca7933e03a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java @@ -139,7 +139,7 @@ public class CRPropertyDescriptorPane { try { Object value = propertyEditor.getValue(); Method m = crPropertyDescriptor.getWriteMethod(); - if (ComparatorUtils.equals(m.getName(), "setWidgetName") && value != null) { + if (ComparatorUtils.equals(m.getName(), "setWidgetName")) { if (!isWidgetNameValid(value, widget)) { value = widget.getWidgetName(); } @@ -154,8 +154,13 @@ public class CRPropertyDescriptorPane { /** * 设置控件名之前校验一下,不能为空,不能重名 */ - public boolean isWidgetNameValid(Object value, Widget widget) { - String toSetWidgetName = value.toString(); + private boolean isWidgetNameValid(Object value, Widget widget) { + String toSetWidgetName; + if (value != null) { + toSetWidgetName = value.toString(); + } else { + return false; + } String currentWidgetName = widget.getWidgetName(); boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); if (toSetWidgetName.isEmpty()) {