mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-21 22:45:06 +00:00
check nil options
This commit is contained in:
@@ -69,13 +69,21 @@ func NewClient(options *Options) *Client {
|
|||||||
ret.options = Options{
|
ret.options = Options{
|
||||||
Address: liveAddress,
|
Address: liveAddress,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no options provided
|
||||||
|
if options == nil {
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
if options.Token != "" {
|
if options.Token != "" {
|
||||||
ret.options.Token = options.Token
|
ret.options.Token = options.Token
|
||||||
}
|
}
|
||||||
if options != nil && options.Local {
|
|
||||||
|
if options.Local {
|
||||||
ret.options.Address = localAddress
|
ret.options.Address = localAddress
|
||||||
ret.options.Local = true
|
ret.options.Local = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user