caller. prevent fatals with "nil" function argument given.

This commit is contained in:
Gennadii Kovalev 2016-08-16 02:30:25 +02:00
parent ccde7b309c
commit 7b8d3aca48
1 changed files with 5 additions and 0 deletions

View File

@ -61,6 +61,11 @@ func (c *caller) getArgs() interface{} {
calls function with given arguments from its representation using reflection
*/
func (c *caller) callFunc(h *Channel, args interface{}) []reflect.Value {
//nil is untyped, so use the default empty value of correct type
if args == nil {
args = c.getArgs()
}
a := []reflect.Value{reflect.ValueOf(h), reflect.ValueOf(args).Elem()}
if !c.ArgsPresent {
a = a[0:1]