From 7b8d3aca48eef84d9abe02a9c37f41b4c687a9e7 Mon Sep 17 00:00:00 2001 From: Gennadii Kovalev Date: Tue, 16 Aug 2016 02:30:25 +0200 Subject: [PATCH] caller. prevent fatals with "nil" function argument given. --- caller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/caller.go b/caller.go index 8e5acef..bb423dd 100644 --- a/caller.go +++ b/caller.go @@ -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]