Skip to content

Commit

Permalink
Merge pull request #562 from powersj/patch-1
Browse files Browse the repository at this point in the history
fix: check connection before closing
  • Loading branch information
magiconair authored Apr 7, 2022
2 parents 6898ac9 + f878f81 commit 543c263
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,9 @@ func (c *Client) CloseWithContext(ctx context.Context) error {

// close the connection but ignore the error since there isn't
// anything we can do about it anyway
c.conn.Close()
if c.conn != nil {
c.conn.Close()
}

return nil
}
Expand Down

0 comments on commit 543c263

Please sign in to comment.