Parcourir la source

:bug: Fix npe

Daniel il y a 1 an
Parent
commit
dc95dc3555
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      kernel/model/blockinfo.go

+ 1 - 1
kernel/model/blockinfo.go

@@ -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 {