diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1dd1613ed..9feab976d 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -15,6 +15,7 @@ This document provides a high-level view of the changes introduced by release. - Handle YAML parsing errors when showing an editor notification about missing information in the Antora component descriptor (#1753) - Preventing NPE when creating a missing file (#1754) - Preventing NPE when parsing block attributes for listings (#1755) +- Handle a situation where an index is not yet known as index not ready (#1756) === 0.43.4 diff --git a/src/main/java/org/asciidoc/intellij/psi/AsciiDocAttributeDeclarationKeyIndex.java b/src/main/java/org/asciidoc/intellij/psi/AsciiDocAttributeDeclarationKeyIndex.java index 7b58160d4..a66cc27dc 100644 --- a/src/main/java/org/asciidoc/intellij/psi/AsciiDocAttributeDeclarationKeyIndex.java +++ b/src/main/java/org/asciidoc/intellij/psi/AsciiDocAttributeDeclarationKeyIndex.java @@ -19,6 +19,7 @@ */ package org.asciidoc.intellij.psi; +import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.stubs.StubIndex; @@ -50,6 +51,14 @@ public Class requiredClass() { @Override public Collection get(@NotNull String key, @NotNull Project project, @NotNull GlobalSearchScope scope) { - return StubIndex.getElements(getKey(), key.toLowerCase(Locale.US), project, scope, requiredClass()); + try { + return StubIndex.getElements(getKey(), key.toLowerCase(Locale.US), project, scope, requiredClass()); + } catch (NullPointerException e) { + if (e.getMessage().startsWith("Can't find stub index extension")) { + throw IndexNotReadyException.create(); + } else { + throw e; + } + } } }