Skip to content

Commit ce71c46

Browse files
dkvashninbaylenaorobei
authored andcommitted
Fixed IndexNotReadyException
(cherry picked from commit 853d217)
1 parent 4e42483 commit ce71c46

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/com/magento/idea/magento2plugin/php/inspections/MagentoApiInspection.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.intellij.codeInspection.ProblemHighlightType;
44
import com.intellij.codeInspection.ProblemsHolder;
5+
import com.intellij.openapi.project.DumbService;
56
import com.intellij.psi.PsiElement;
67
import com.intellij.psi.PsiElementVisitor;
78
import com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment;
@@ -42,6 +43,7 @@ public void visitPhpMethodReference(MethodReference reference) {
4243
if (!Settings.isEnabled(reference.getProject())) {
4344
return;
4445
}
46+
4547
PsiElement referencedElement = reference.resolve();
4648

4749
if(referencedElement instanceof Method) {

src/com/magento/idea/magento2plugin/php/module/MagentoComponentManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.intellij.json.psi.JsonFile;
44
import com.intellij.json.psi.JsonObject;
5+
import com.intellij.openapi.project.DumbService;
56
import com.intellij.openapi.project.Project;
67
import com.intellij.openapi.vfs.VirtualFile;
78
import com.intellij.psi.PsiDirectory;
@@ -57,6 +58,10 @@ public <T extends MagentoComponent> Collection<T> getAllComponentsOfType(@NotNul
5758
}
5859

5960
synchronized private Map<String, MagentoComponent> getComponents() {
61+
if (DumbService.getInstance(project).isDumb()) {
62+
return new HashMap<>();
63+
}
64+
6065
if (cacheStartTime + CACHE_LIFE_TIME < System.currentTimeMillis()) {
6166
flushModules();
6267
loadModules();

0 commit comments

Comments
 (0)