Przeglądaj źródła

Merge pull request #214 from fkm3/open_panic

Don't try old auth method on closed conn
Julien Schmidt 12 lat temu
rodzic
commit
d434fb40f1
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      driver.go

+ 1 - 1
driver.go

@@ -84,7 +84,7 @@ func (d *MySQLDriver) Open(dsn string) (driver.Conn, error) {
 	err = mc.readResultOK()
 	if err != nil {
 		// Retry with old authentication method, if allowed
-		if mc.cfg.allowOldPasswords && err == errOldPassword {
+		if mc.cfg != nil && mc.cfg.allowOldPasswords && err == errOldPassword {
 			if err = mc.writeOldAuthPacket(cipher); err != nil {
 				mc.Close()
 				return nil, err