Procházet zdrojové kódy

session: connection pool may be nil on close

When the connConfig errors the connection pool will not be created,
check that it is not nil before closing it.
Chris Bannister před 10 roky
rodič
revize
c62a9b5633
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      session.go

+ 3 - 1
session.go

@@ -248,7 +248,9 @@ func (s *Session) Close() {
 	}
 	}
 	s.isClosed = true
 	s.isClosed = true
 
 
-	s.pool.Close()
+	if s.pool != nil {
+		s.pool.Close()
+	}
 
 
 	if s.hostSource != nil {
 	if s.hostSource != nil {
 		close(s.hostSource.closeChan)
 		close(s.hostSource.closeChan)