浏览代码

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 10 年之前
父节点
当前提交
c62a9b5633
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      session.go

+ 3 - 1
session.go

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