caller. prevent fatals with "nil" function argument given.
This commit is contained in:
parent
ccde7b309c
commit
7b8d3aca48
|
@ -61,6 +61,11 @@ func (c *caller) getArgs() interface{} {
|
||||||
calls function with given arguments from its representation using reflection
|
calls function with given arguments from its representation using reflection
|
||||||
*/
|
*/
|
||||||
func (c *caller) callFunc(h *Channel, args interface{}) []reflect.Value {
|
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()}
|
a := []reflect.Value{reflect.ValueOf(h), reflect.ValueOf(args).Elem()}
|
||||||
if !c.ArgsPresent {
|
if !c.ArgsPresent {
|
||||||
a = a[0:1]
|
a = a[0:1]
|
||||||
|
|
Loading…
Reference in New Issue