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() {
|
||||
response := jail.Send(call)
|
||||
|
||||
// run callback asyncronously with args (error, response)
|
||||
callback := call.Argument(1)
|
||||
if callback.Class() == "Function" {
|
||||
// run callback asyncronously with args (error, response)
|
||||
err := otto.NullValue()
|
||||
cell.CallAsync(callback, err, response)
|
||||
}
|
||||
}()
|
||||
return otto.UndefinedValue()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue