check nil options

This commit is contained in:
Asim Aslam
2021-04-21 15:20:16 +01:00
parent 4f3b55fa74
commit facbb32e8e

View File

@@ -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
}