فهرست منبع

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