vm: check errors early to avoid infinite loop

This commit is contained in:
Ethan Buchman 2015-03-21 01:44:47 -07:00
parent e56db7f615
commit bf87ec1070
1 changed files with 5 additions and 4 deletions

View File

@ -83,6 +83,11 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value uint64, ga
)
for {
// If there is an error, return
if err != nil {
return nil, err
}
var op = codeGetOp(code, pc)
fmt.Printf("(pc) %-3d (op) %-14s (st) %-4d ", pc, op.String(), stack.Len())
@ -652,10 +657,6 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value uint64, ga
pc++
// If there is an error, return
if err != nil {
return nil, err
}
}
}