KotlinUastLanguagePlugin#convertElementWithParent NPE fix when parent is null (#1247)

This commit is contained in:
xiexed
2017-08-16 17:47:40 +03:00
committed by Dmitry Jemerov
parent a2a018eadb
commit 12eb4ef37a
@@ -74,8 +74,8 @@ class KotlinUastLanguagePlugin : UastLanguagePlugin {
val parentUnwrapped = KotlinConverter.unwrapElements(parent) ?: return null
if (parent is KtValueArgument && parentUnwrapped is KtAnnotationEntry) {
val argumentName = parent.getArgumentName()?.asName?.asString() ?: ""
return (convertElementWithParent(parentUnwrapped, null) as UAnnotation)
.attributeValues.find { it.name == argumentName }
return (convertElementWithParent(parentUnwrapped, null) as? UAnnotation)
?.attributeValues?.find { it.name == argumentName }
}
else
return convertElementWithParent(parentUnwrapped, null)