Commit b99fe8b9 authored by Etienne Renault's avatar Etienne Renault

cfg: fix slice bounds of range error

* transform/cfg/build.go: Here.
parent c8c1c3f7
......@@ -94,6 +94,10 @@ func Build(meta *transform.Meta, block *ast.BlockStmt) *Graph {
switch len(block.Succs) {
case 0:
var prev *Single
if len(block.Nodes) == 0 {
continue
}
for _, node := range block.Nodes[:len(block.Nodes)-1] {
idx := len(graph.Nodes)
node := &Single{
......@@ -144,6 +148,10 @@ func Build(meta *transform.Meta, block *ast.BlockStmt) *Graph {
}
case 2:
var prev *Single
if len(block.Nodes) == 0 {
continue
}
for _, node := range block.Nodes[:len(block.Nodes)-1] {
idx := len(graph.Nodes)
node := &Single{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment