lightClassUtils: Fix CCE when trying to obtain KtLightTypeParameter

#KT-12259 Fixed
This commit is contained in:
Pavel V. Talanov
2016-05-23 16:40:45 +03:00
parent 62421bbf7b
commit 710e920df7
4 changed files with 10 additions and 1 deletions
@@ -104,7 +104,7 @@ fun KtTypeParameter.toPsiTypeParameters(): List<PsiTypeParameter> {
val jetDeclaration = paramList.getNonStrictParentOfType<KtDeclaration>() ?: return listOf()
val lightOwners = jetDeclaration.toLightElements()
return lightOwners.map { lightOwner -> (lightOwner as PsiTypeParameterListOwner).typeParameters[paramIndex] }
return lightOwners.mapNotNull { lightOwner -> (lightOwner as? PsiTypeParameterListOwner)?.typeParameters?.get(paramIndex) }
}
// Returns original declaration if given PsiElement is a Kotlin light element, and element itself otherwise