vm: don't panic if there is no result in PopResult()
This function is intended to be ran outside of the execute's panic recovery mechanism, so it shouldn't panic if there is no result.
This commit is contained in:
parent
a357d99624
commit
705c7f106f
1 changed files with 5 additions and 1 deletions
|
@ -187,7 +187,11 @@ func (v *VM) Context() *Context {
|
|||
// PopResult is used to pop the first item of the evaluation stack. This allows
|
||||
// us to test compiler and vm in a bi-directional way.
|
||||
func (v *VM) PopResult() interface{} {
|
||||
return v.estack.Pop().value.Value()
|
||||
e := v.estack.Pop()
|
||||
if e != nil {
|
||||
return e.Value()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stack returns json formatted representation of the given stack.
|
||||
|
|
Loading…
Reference in a new issue