handle elements with null containing file (EA-84533 - IAE: KtPsiFactoryKt.getModuleInfo)

This commit is contained in:
Dmitry Jemerov
2016-10-13 19:49:23 +02:00
committed by Ilya Gorbunov
parent ada6e2a906
commit 221b55550c
@@ -44,7 +44,7 @@ fun PsiElement.getNullableModuleInfo(): IdeaModuleInfo? = this.getModuleInfo { r
}
private fun PsiElement.getModuleInfo(onFailure: (String) -> IdeaModuleInfo?): IdeaModuleInfo? {
(containingFile.moduleInfo as? IdeaModuleInfo)?.let { return it }
(containingFile?.moduleInfo as? IdeaModuleInfo)?.let { return it }
if (this is KtLightElement<*, *>) return this.getModuleInfoForLightElement(onFailure)