From d45dd6a44aac967b7b352ae322ad6230e052a175 Mon Sep 17 00:00:00 2001 From: Mickael Remond Date: Fri, 7 Jun 2019 12:16:58 +0200 Subject: [PATCH] Returned client will be nil if parameter are incorrect --- client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index d269d7c..08ea283 100644 --- a/client.go +++ b/client.go @@ -86,14 +86,14 @@ func NewClient(config Config) (c *Client, err error) { return } - c = new(Client) - c.config = config - // Parse JID - if c.config.parsedJid, err = NewJid(c.config.Jid); err != nil { + if config.parsedJid, err = NewJid(c.config.Jid); err != nil { return } + c = new(Client) + c.config = config + if c.config.ConnectTimeout == 0 { c.config.ConnectTimeout = 15 // 15 second as default }