From c8bad15ba9bd630674bbf7d1b10f82c6def5f936 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Thu, 5 Mar 2020 20:57:04 +0900 Subject: [PATCH] Fix EA-210182, check for context validity --- compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt index dc54dcb17fc..27345992b08 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt @@ -172,7 +172,7 @@ abstract class KtCodeFragment( override fun getExceptionHandler() = exceptionHandler fun getContextContainingFile(): KtFile? { - return getOriginalContext()?.containingKtFile + return getOriginalContext()?.takeIf { it.isValid }?.containingKtFile } fun getOriginalContext(): KtElement? {