diff --git a/vm/runner.go b/vm/runner.go index 92463ee..302093d 100644 --- a/vm/runner.go +++ b/vm/runner.go @@ -178,9 +178,13 @@ func(vm *Vm) RunCatch(b []byte, ctx context.Context) ([]byte, error) { } if r { log.Printf("catch at flag %v, moving to %v", sig, sym) //bitField, d) + bh, err := vm.rs.GetCode(sym) + if err != nil { + return b, err + } vm.st.Down(sym) + vm.ca.Push() vm.Reset() - bh := NewLine(nil, HALT, nil, nil, nil) b = append(bh, b...) } return b, nil diff --git a/vm/runner_test.go b/vm/runner_test.go index 7da7ef4..2ed19fc 100644 --- a/vm/runner_test.go +++ b/vm/runner_test.go @@ -120,6 +120,7 @@ func(r TestResource) GetCode(sym string) ([]byte, error) { case "flagCatch": b = NewLine(b, MOUT, []string{"0", "repent"}, nil, nil) b = NewLine(b, HALT, nil, nil, nil) + b = NewLine(b, MOVE, []string{"_"}, nil, nil) } return b, nil