From ae7687422ce6f47c950aa333868ba999b7a1cefb Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 29 Oct 2019 12:53:09 +0300 Subject: [PATCH] vm: clear state in Load() Make VM usable after the first run. --- pkg/vm/vm.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index 122e4062b..40fe95952 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -196,10 +196,11 @@ func (v *VM) LoadFile(path string) error { // Load initializes the VM with the program given. func (v *VM) Load(prog []byte) { - // clear all stacks, it could be a reload. + // Clear all stacks and state, it could be a reload. v.istack.Clear() v.estack.Clear() v.astack.Clear() + v.state = noneState v.LoadScript(prog) }