console: fix return via callbacks (#2910)

Fixes #2872
This commit is contained in:
cdetrio 2016-08-15 17:52:47 -04:00 committed by Felix Lange
parent d6625ac34d
commit 077353b47e
1 changed files with 2 additions and 2 deletions

View File

@ -255,8 +255,8 @@ func (b *bridge) Send(call otto.FunctionCall) (response otto.Value) {
} else {
response, _ = resps.Get("0")
}
if fn := call.Argument(1).Object(); fn != nil && fn.Class() == "function" {
fn.Call("apply", response)
if fn := call.Argument(1); fn.Class() == "Function" {
fn.Call(otto.NullValue(), otto.NullValue(), response)
return otto.UndefinedValue()
}
return response