🐛 Fix npe

This commit is contained in:
Daniel 2024-03-18 16:15:39 +08:00
parent 21b64d3710
commit dc95dc3555
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -253,7 +253,7 @@ func GetBlockIndex(id string) (ret int) {
}
rootChild := node
for ; nil == rootChild.Parent || ast.NodeDocument != rootChild.Parent.Type; rootChild = rootChild.Parent {
for ; nil != rootChild.Parent && ast.NodeDocument != rootChild.Parent.Type; rootChild = rootChild.Parent {
}
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {