ソースを参照

Don't try closing something that doesn't exist

Fixes #27
Matt Robenolt 12 年 前
コミット
776c8a6e60
1 ファイル変更3 行追加0 行削除
  1. 3 0
      gocql.go

+ 3 - 0
gocql.go

@@ -204,6 +204,9 @@ func (cn *connection) open() {
 // close a connection actively, typically used when there's an error and we want to ensure
 // we don't repeatedly try to use the broken connection
 func (cn *connection) close() {
+	if cn.c == nil {
+		return
+	}
 	cn.c.Close()
 	cn.c = nil // ensure we generate ErrBadConn when cn gets reused
 	cn.alive = false