[FIR] Fix NPE in light tree source utils
This commit is contained in:
+3
-3
@@ -45,10 +45,10 @@ private val DOC_AND_COMMENT_TOKENS = setOf(
|
|||||||
private fun hasSyntaxErrors(node: LighterASTNode, tree: FlyweightCapableTreeStructure<LighterASTNode>): Boolean {
|
private fun hasSyntaxErrors(node: LighterASTNode, tree: FlyweightCapableTreeStructure<LighterASTNode>): Boolean {
|
||||||
if (node.tokenType == TokenType.ERROR_ELEMENT) return true
|
if (node.tokenType == TokenType.ERROR_ELEMENT) return true
|
||||||
|
|
||||||
val childrenRef = Ref<Array<LighterASTNode>>()
|
val childrenRef = Ref<Array<LighterASTNode?>?>()
|
||||||
tree.getChildren(node, childrenRef)
|
tree.getChildren(node, childrenRef)
|
||||||
val children = childrenRef.get()
|
val children = childrenRef.get() ?: return false
|
||||||
return children.lastOrNull {
|
return children.filterNotNull().lastOrNull {
|
||||||
val tokenType = it.tokenType
|
val tokenType = it.tokenType
|
||||||
tokenType !is KtSingleValueToken && tokenType !in DOC_AND_COMMENT_TOKENS
|
tokenType !is KtSingleValueToken && tokenType !in DOC_AND_COMMENT_TOKENS
|
||||||
}?.let { hasSyntaxErrors(it, tree) } == true
|
}?.let { hasSyntaxErrors(it, tree) } == true
|
||||||
|
|||||||
Reference in New Issue
Block a user