Returned client will be nil if parameter are incorrect

This commit is contained in:
Mickael Remond 2019-06-07 12:16:58 +02:00
parent b8fdc510a6
commit d45dd6a44a
No known key found for this signature in database
GPG Key ID: E6F6045D79965AA3

View File

@ -86,14 +86,14 @@ func NewClient(config Config) (c *Client, err error) {
return return
} }
c = new(Client)
c.config = config
// Parse JID // Parse JID
if c.config.parsedJid, err = NewJid(c.config.Jid); err != nil { if config.parsedJid, err = NewJid(c.config.Jid); err != nil {
return return
} }
c = new(Client)
c.config = config
if c.config.ConnectTimeout == 0 { if c.config.ConnectTimeout == 0 {
c.config.ConnectTimeout = 15 // 15 second as default c.config.ConnectTimeout = 15 // 15 second as default
} }