From facbb32e8efb32743ab0f7226c69b2d506cf101f Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 21 Apr 2021 15:20:16 +0100 Subject: [PATCH] check nil options --- client/client.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index 499d10a..222dccc 100644 --- a/client/client.go +++ b/client/client.go @@ -69,13 +69,21 @@ func NewClient(options *Options) *Client { ret.options = Options{ Address: liveAddress, } + + // no options provided + if options == nil { + return ret + } + if options.Token != "" { ret.options.Token = options.Token } - if options != nil && options.Local { + + if options.Local { ret.options.Address = localAddress ret.options.Local = true } + return ret }