fix(common): prevent crashing when parsing comment trees

Fixes COMPOSE-LOBSTERS-1Z
This commit is contained in:
Harsh Shandilya 2023-10-06 13:51:18 +05:30
parent 1a525d6e5d
commit 6226c3b0c8
No known key found for this signature in database

View file

@ -25,7 +25,7 @@ internal data class CommentNode(
child.parent = this child.parent = this
} else { } else {
child.indentLevel += 1 child.indentLevel += 1
children.last().addChild(child) children.lastOrNull()?.addChild(child)
} }
} }
} }
@ -47,7 +47,7 @@ internal fun createListNode(
) )
) )
} else { } else {
commentNodes.last().let { commentNodes.lastOrNull()?.let {
it.addChild( it.addChild(
CommentNode( CommentNode(
comment = comments[i], comment = comments[i],