Skip to content

Commit e01702b

Browse files
author
Vitaliy Boyko
committed
Fixed error when plugin or observer name is not set
1 parent 178e05c commit e01702b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ public void visitFile(final PsiFile file) {
124124
if (observerDisabledAttribute != null
125125
&& observerDisabledAttribute.getValue() != null
126126
&& observerDisabledAttribute.getValue().equals("true")
127+
&& !observerName.isEmpty()
127128
) {
128-
if (modulesWithSameObserverName.isEmpty()) {
129+
@Nullable XmlAttributeValue valueElement = observerNameAttribute.getValueElement();
130+
if (modulesWithSameObserverName.isEmpty() && valueElement != null) {
129131
problemsHolder.registerProblem(
130-
observerNameAttribute.getValueElement(),
132+
valueElement,
131133
inspectionBundle.message(
132134
"inspection.observer.disabledObserverDoesNotExist"
133135
),

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,16 @@ public void visitFile(final PsiFile file) {
118118
if (pluginTypeDisabledAttribute != null
119119
&& pluginTypeDisabledAttribute.getValue() != null
120120
&& pluginTypeDisabledAttribute.getValue().equals("true")
121+
&& !pluginTypeName.isEmpty()
121122
) {
122-
if (modulesWithSamePluginName.isEmpty()) {
123+
@Nullable XmlAttributeValue valueElement = pluginTypeNameAttribute.getValueElement();
124+
if (modulesWithSamePluginName.isEmpty() && valueElement != null) {
123125
problemsHolder.registerProblem(
124-
pluginTypeNameAttribute.getValueElement(),
125-
inspectionBundle.message(
126-
"inspection.plugin.disabledPluginDoesNotExist"
127-
),
128-
errorSeverity
126+
valueElement,
127+
inspectionBundle.message(
128+
"inspection.plugin.disabledPluginDoesNotExist"
129+
),
130+
errorSeverity
129131
);
130132
} else {
131133
continue;

0 commit comments

Comments
 (0)