Skip to content

Commit 084b53a

Browse files
committed
fixed error when adding an attribute with empty value
1 parent d92b020 commit 084b53a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/com/magento/idea/magento2plugin/inspections/xml/InvalidDependencyInjectionTypeInspection.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public void visitXmlTag(final @NotNull XmlTag xmlTag) {
5555

5656
if (nameAttribute == null
5757
|| nameAttribute.getValue() == null
58-
|| nameAttribute.getValueElement() == null) {
58+
|| nameAttribute.getValueElement() == null
59+
|| nameAttribute.getValueElement().getText().isEmpty()) {
5960
return;
6061
}
6162

@@ -100,8 +101,9 @@ private void checkObjectArgumentsRecursively(final @NotNull XmlTag tag) {
100101
final XmlAttribute xsiTypeAttr = tag.getAttribute(ModuleDiXml.XSI_TYPE_ATTR);
101102

102103
if (xsiTypeAttr == null
104+
|| xsiTypeAttr.getValue() == null
103105
|| xsiTypeAttr.getValueElement() == null
104-
|| xsiTypeAttr.getValue() == null) {
106+
|| xsiTypeAttr.getValueElement().getText().isEmpty()) {
105107
return;
106108
}
107109
final String xsiTypeValue = xsiTypeAttr.getValue();

src/com/magento/idea/magento2plugin/inspections/xml/PreferenceDeclarationInspection.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public void visitXmlTag(final XmlTag xmlTag) {
5050

5151
if (preferenceForAttribute == null
5252
|| preferenceForAttribute.getValue() == null
53-
|| preferenceForAttribute.getValueElement() == null) {
53+
|| preferenceForAttribute.getValueElement() == null
54+
|| preferenceForAttribute.getValueElement().getText().isEmpty()) {
5455
return;
5556
}
5657

@@ -66,7 +67,8 @@ public void visitXmlTag(final XmlTag xmlTag) {
6667

6768
if (preferenceTypeAttribute == null
6869
|| preferenceTypeAttribute.getValue() == null
69-
|| preferenceTypeAttribute.getValueElement() == null) {
70+
|| preferenceTypeAttribute.getValueElement() == null
71+
|| preferenceTypeAttribute.getValueElement().getText().isEmpty()) {
7072
return;
7173
}
7274

0 commit comments

Comments
 (0)