diff --git a/src/com/magento/idea/magento2plugin/inspections/xml/ObserverDeclarationInspection.java b/src/com/magento/idea/magento2plugin/inspections/xml/ObserverDeclarationInspection.java index 89c02fd4a..71e5dc2ee 100644 --- a/src/com/magento/idea/magento2plugin/inspections/xml/ObserverDeclarationInspection.java +++ b/src/com/magento/idea/magento2plugin/inspections/xml/ObserverDeclarationInspection.java @@ -100,6 +100,10 @@ public void visitFile(final PsiFile file) { } final String observerName = observerNameAttribute.getValue(); + if (observerName == null) { + continue; + } + final String observerKey = eventNameAttributeValue.concat("_") .concat(observerName); if (targetObserversHash.containsKey(observerKey)) { @@ -124,10 +128,13 @@ public void visitFile(final PsiFile file) { if (observerDisabledAttribute != null && observerDisabledAttribute.getValue() != null && observerDisabledAttribute.getValue().equals("true") + && !observerName.isEmpty() ) { - if (modulesWithSameObserverName.isEmpty()) { + @Nullable final XmlAttributeValue valueElement + = observerNameAttribute.getValueElement(); + if (modulesWithSameObserverName.isEmpty() && valueElement != null) { problemsHolder.registerProblem( - observerNameAttribute.getValueElement(), + valueElement, inspectionBundle.message( "inspection.observer.disabledObserverDoesNotExist" ), diff --git a/src/com/magento/idea/magento2plugin/inspections/xml/PluginDeclarationInspection.java b/src/com/magento/idea/magento2plugin/inspections/xml/PluginDeclarationInspection.java index 13bd807b5..33a325c15 100644 --- a/src/com/magento/idea/magento2plugin/inspections/xml/PluginDeclarationInspection.java +++ b/src/com/magento/idea/magento2plugin/inspections/xml/PluginDeclarationInspection.java @@ -93,6 +93,10 @@ public void visitFile(final PsiFile file) { } final String pluginTypeName = pluginTypeNameAttribute.getValue(); + if (pluginTypeName == null) { + continue; + } + final String pluginTypeKey = pluginNameAttributeValue.concat( Package.vendorModuleNameSeparator ).concat(pluginTypeName); @@ -118,14 +122,17 @@ public void visitFile(final PsiFile file) { if (pluginTypeDisabledAttribute != null && pluginTypeDisabledAttribute.getValue() != null && pluginTypeDisabledAttribute.getValue().equals("true") + && !pluginTypeName.isEmpty() ) { - if (modulesWithSamePluginName.isEmpty()) { + @Nullable final XmlAttributeValue valueElement + = pluginTypeNameAttribute.getValueElement(); + if (modulesWithSamePluginName.isEmpty() && valueElement != null) { problemsHolder.registerProblem( - pluginTypeNameAttribute.getValueElement(), - inspectionBundle.message( - "inspection.plugin.disabledPluginDoesNotExist" - ), - errorSeverity + valueElement, + inspectionBundle.message( + "inspection.plugin.disabledPluginDoesNotExist" + ), + errorSeverity ); } else { continue;