diff --git a/net/gobrpc/client.go b/net/gobrpc/client.go index 240c8cc..bebc01c 100644 --- a/net/gobrpc/client.go +++ b/net/gobrpc/client.go @@ -44,6 +44,10 @@ func (c *RPCClient) Call(method string, args interface{}, reply interface{}, cal done := make(chan error, 1) go func() { + if c.rpcClient == nil { + done <- fmt.Errorf("rpc client is nil") + return + } err := c.rpcClient.Call(method, args, reply) done <- err }() @@ -59,6 +63,4 @@ func (c *RPCClient) Call(method string, args interface{}, reply interface{}, cal case err := <-done: return err } - - return nil }