Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 98fe0ee

Browse files
authoredApr 26, 2021
Fixed logic issue
1 parent 7e9c70c commit 98fe0ee

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed
 

‎activity/jsexec/activity.go

+21-18
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,28 @@ func (a *Activity) Eval(ctx activity.Context) (done bool, err error) {
5757
if err != nil {
5858
output.Error = true
5959
output.ErrorMessage = err.Error()
60-
return true, nil
61-
}
62-
//todo is ok to ignore the errors for the SetInVM calls?
63-
_ = vm.SetInVM("parameters", input.Parameters)
64-
_ = vm.SetInVM("result", result)
65-
66-
_, err = vm.vm.RunScript("JSServiceScript", a.script)
67-
if err != nil {
68-
output.Error = true
69-
output.ErrorMessage = err.Error()
70-
return true, nil
7160
}
72-
err = vm.GetFromVM("result", &result)
73-
if err != nil {
74-
output.Error = true
75-
output.ErrorMessage = err.Error()
76-
return true, nil
77-
}
78-
output.Result = result
61+
if vm != nil {
62+
//todo is ok to ignore the errors for the SetInVM calls?
63+
_ = vm.SetInVM("parameters", input.Parameters)
64+
_ = vm.SetInVM("result", result)
65+
66+
_, err = vm.vm.RunScript("JSServiceScript", a.script)
67+
if err != nil {
68+
output.Error = true
69+
output.ErrorMessage = err.Error()
70+
} else {
71+
err = vm.GetFromVM("result", &result)
72+
if err != nil {
73+
output.Error = true
74+
output.ErrorMessage = err.Error()
75+
} else {
76+
output.Error = false
77+
output.ErrorMessage = ""
78+
output.Result = result
79+
}
80+
}
81+
}
7982

8083
err = ctx.SetOutputObject(&output)
8184
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.