vm: fix double VM run from CLI
Fixes one more instruction being ran when VM FAULTs: NEO-GO-VM > run NEO-GO-VM > error encountered at instruction 6 (ROLL) NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference FAULT NEO-GO-VM > error encountered at instruction 7 (SETITEM) NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8 Refs. #96.
This commit is contained in:
parent
428e789ddc
commit
42dfca47cf
1 changed files with 8 additions and 11 deletions
|
@ -127,16 +127,13 @@ func (c *VMCLI) handleCommand(cmd string, args ...string) {
|
||||||
fmt.Printf("READY: loaded %d instructions\n", c.vm.Context().LenInstr())
|
fmt.Printf("READY: loaded %d instructions\n", c.vm.Context().LenInstr())
|
||||||
|
|
||||||
case "run":
|
case "run":
|
||||||
var (
|
if len(args) != 0 {
|
||||||
method []byte
|
var (
|
||||||
params []vm.StackItem
|
method []byte
|
||||||
err error
|
params []vm.StackItem
|
||||||
start int
|
err error
|
||||||
)
|
start int
|
||||||
|
)
|
||||||
if len(args) == 0 {
|
|
||||||
c.vm.Run()
|
|
||||||
} else {
|
|
||||||
if isMethodArg(args[0]) {
|
if isMethodArg(args[0]) {
|
||||||
method = []byte(args[0])
|
method = []byte(args[0])
|
||||||
start = 1
|
start = 1
|
||||||
|
@ -146,8 +143,8 @@ func (c *VMCLI) handleCommand(cmd string, args ...string) {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
c.vm.LoadArgs(method, params)
|
||||||
}
|
}
|
||||||
c.vm.LoadArgs(method, params)
|
|
||||||
c.vm.Run()
|
c.vm.Run()
|
||||||
|
|
||||||
case "cont":
|
case "cont":
|
||||||
|
|
Loading…
Reference in a new issue