Check for callback in makeAsyncHandler (#395)
This PR fixes regression from 3540972
and adds check for callback validity before putting it into event loop for sendAsync calls.
This commit is contained in:
parent
e6b426e094
commit
d4496332f9
|
@ -75,10 +75,12 @@ func makeAsyncSendHandler(jail *Jail, cellInt common.JailCell) func(call otto.Fu
|
||||||
go func() {
|
go func() {
|
||||||
response := jail.Send(call)
|
response := jail.Send(call)
|
||||||
|
|
||||||
// run callback asyncronously with args (error, response)
|
|
||||||
callback := call.Argument(1)
|
callback := call.Argument(1)
|
||||||
err := otto.NullValue()
|
if callback.Class() == "Function" {
|
||||||
cell.CallAsync(callback, err, response)
|
// run callback asyncronously with args (error, response)
|
||||||
|
err := otto.NullValue()
|
||||||
|
cell.CallAsync(callback, err, response)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
return otto.UndefinedValue()
|
return otto.UndefinedValue()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue