Skip to content

Commit ae22d23

Browse files
authored
Merge pull request #11 from VadimIpatov/master
fixed possible crash when establishing a connection
2 parents 011d41e + 6324209 commit ae22d23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server_conn.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ func (sc *serverConn) connect() error {
102102
// Error, except if the server doesn't support authentication
103103
mErr := err.(*Error)
104104
if mErr.Status != StatusUnknownCommand {
105-
sc.conn.Close()
106-
sc.conn = nil
105+
if sc.conn != nil {
106+
sc.conn.Close()
107+
sc.conn = nil
108+
}
107109
return err
108110
}
109111
}

0 commit comments

Comments
 (0)