Copy: Filter out invalid elements to prevent PsiInvalidElementAccessException
#KT-12747 Fixed (cherry picked from commit 4a0a440)
This commit is contained in:
@@ -27,7 +27,7 @@ class CopyKotlinFileHandler : CopyHandlerDelegateBase() {
|
||||
|
||||
private fun adjustElements(elements: Array<out PsiElement>): Array<PsiElement>? {
|
||||
return elements
|
||||
.map { it.containingFile as? KtFile ?: return null }
|
||||
.map { (if (it.isValid) it.containingFile as? KtFile else null) ?: return null }
|
||||
.toTypedArray()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user