Browse Source

vm: check errors early to avoid infinite loop

pull/33/head
Ethan Buchman 10 years ago
parent
commit
bf87ec1070
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      vm/vm.go

+ 5
- 4
vm/vm.go View File

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


Loading…
Cancel
Save