|
8 | 8 | import com.intellij.codeInspection.ProblemHighlightType;
|
9 | 9 | import com.intellij.codeInspection.ProblemsHolder;
|
10 | 10 | import com.intellij.ide.highlighter.XmlFileType;
|
| 11 | +import com.intellij.openapi.externalSystem.service.execution.NotSupportedException; |
11 | 12 | import com.intellij.openapi.vfs.VfsUtil;
|
12 | 13 | import com.intellij.openapi.vfs.VirtualFile;
|
13 | 14 | import com.intellij.psi.PsiElement;
|
@@ -71,6 +72,10 @@ public void visitFile(final @NotNull PsiFile file) {
|
71 | 72 | return;
|
72 | 73 | }
|
73 | 74 |
|
| 75 | + // This added to cover case if file exists only in memory. |
| 76 | + if (file.getContainingDirectory() == null) { |
| 77 | + return; |
| 78 | + } |
74 | 79 | final EventIndex eventIndex = new EventIndex(file.getProject());
|
75 | 80 | final HashMap<String, XmlTag> targetObserversHash = new HashMap<>();
|
76 | 81 |
|
@@ -108,7 +113,8 @@ public void visitFile(final @NotNull PsiFile file) {
|
108 | 113 | }
|
109 | 114 |
|
110 | 115 | final String observerName = observerNameAttribute.getValue();
|
111 |
| - if (observerName == null) { |
| 116 | + if (observerName == null |
| 117 | + || observerNameAttribute.getValueElement() == null) { |
112 | 118 | continue;
|
113 | 119 | }
|
114 | 120 |
|
@@ -188,6 +194,11 @@ private List<HashMap<String, String>> fetchModuleNamesWhereSameObserverNameUsed(
|
188 | 194 | final EventIndex eventIndex,
|
189 | 195 | final PsiFile file
|
190 | 196 | ) {
|
| 197 | + if (file.getContainingDirectory() == null) { |
| 198 | + throw new NotSupportedException( |
| 199 | + "Operation is not supported for files in memory" |
| 200 | + ); |
| 201 | + } |
191 | 202 | final List<HashMap<String, String>> modulesName = new ArrayList<>();
|
192 | 203 | final String currentFileDirectory = file.getContainingDirectory().toString();
|
193 | 204 | final String currentFileFullPath = currentFileDirectory
|
|
0 commit comments